Class: Flickry::Location
- Inherits:
-
Base
- Object
- OpenStruct
- SuperStruct
- Base
- Flickry::Location
- Defined in:
- lib/flickry/location.rb
Instance Method Summary collapse
-
#initialize(locus) ⇒ Location
constructor
A new instance of Location.
Methods inherited from Base
Methods inherited from SuperStruct
#[], #[]=, #each, #each_pair, #members
Constructor Details
#initialize(locus) ⇒ Location
Returns a new instance of Location.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/flickry/location.rb', line 5 def initialize(locus) super(nil) extract_attrs!(locus, [:accuracy, :latitude, :longitude, :place_id, :woeid]) [:country, :county, :locality, :neighbourhood, :region].each do |scale| if locus.respond_to?(scale) and loc = locus.send(scale) self[scale] = Flickry::Place.new(loc, scale) else self[scale] = nil end end end |