Class: Geocoder::IpAddress
- Inherits:
-
String
- Object
- String
- Geocoder::IpAddress
- Defined in:
- lib/geocoder/ip_address.rb
Instance Method Summary collapse
Instance Method Details
#loopback? ⇒ Boolean
4 5 6 |
# File 'lib/geocoder/ip_address.rb', line 4 def loopback? valid? and (self == "0.0.0.0" or self.match(/\A127\./)) end |
#valid? ⇒ Boolean
8 9 10 |
# File 'lib/geocoder/ip_address.rb', line 8 def valid? !!self.match(/\A(::ffff:)?(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\z/) end |