Skip to content

Commit

Permalink
Merge pull request #1675 from mattlemx/ipaddr_nomethod_error
Browse files Browse the repository at this point in the history
Fixed NoMethod error when querying with an instance of IPAddr
  • Loading branch information
alexreisner authored Dec 18, 2024
2 parents 134eacb + c4264dd commit 05ff71a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit 05ff71a

Please sign in to comment.