Class: Focus
- Inherits:
-
Object
- Object
- Focus
- Includes:
- HTTParty
- Defined in:
- lib/focus.rb,
lib/focus/data.rb,
lib/focus/country.rb,
lib/focus/location.rb
Defined Under Namespace
Classes: Country, Data, Location
Instance Attribute Summary collapse
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
Class Method Summary collapse
-
.key(ip_address, prefix = "focus") ⇒ Object
generate a key from the ip_address.
Instance Method Summary collapse
- #country ⇒ Object
-
#initialize(ip_address) ⇒ Focus
constructor
A new instance of Focus.
- #location ⇒ Object
Constructor Details
Instance Attribute Details
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
13 14 15 |
# File 'lib/focus.rb', line 13 def ip @ip end |
Class Method Details
.key(ip_address, prefix = "focus") ⇒ Object
generate a key from the ip_address
23 24 25 26 27 28 29 30 |
# File 'lib/focus.rb', line 23 def self.key(ip_address, prefix="focus") raise unless self.valid?(ip_address) segments = [prefix] # this ip_address does not need to be encoded as it is a valid # ip_address and only contains key-friendly chars segments << ip_address segments.join('-') end |