Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed NoMethod error when querying with an instance of IPAddr #1675

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/geocoder/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def sanitized_text
text.split(/\s*,\s*/).join(',')
end
else
text.strip
text.to_s.strip
end
end

Expand Down
4 changes: 4 additions & 0 deletions test/unit/query_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ class QueryTest < GeocoderTestCase

def test_detect_ipv4
assert Geocoder::Query.new("232.65.123.94").ip_address?
ip = IPAddr.new("232.65.123.94")
assert Geocoder::Query.new(ip).ip_address?
end

def test_detect_ipv6
assert Geocoder::Query.new("3ffe:0b00:0000:0000:0001:0000:0000:000a").ip_address?
ip = IPAddr.new("3ffe:0b00:0000:0000:0001:0000:0000:000a")
assert Geocoder::Query.new(ip).ip_address?
end

def test_detect_non_ip_address
Expand Down
Loading