Class: CloudMade::GeoResults
- Inherits:
-
Object
- Object
- CloudMade::GeoResults
- Defined in:
- lib/geocoding.rb
Overview
Parsed results of geocoding request
Instance Attribute Summary collapse
-
#bounds ⇒ Object
Bounds of result set.
-
#found ⇒ Object
Founded results.
-
#results ⇒ Object
List of found GeoResult objects.
Instance Method Summary collapse
-
#initialize(data) ⇒ GeoResults
constructor
A new instance of GeoResults.
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ GeoResults
Returns a new instance of GeoResults.
99 100 101 102 103 104 105 |
# File 'lib/geocoding.rb', line 99 def initialize(data) self.found = Integer(data['found']) if (data['features'] != nil) then self.results = data['features'].map { |feature_data| CloudMade::GeoResult.new(feature_data) } end self.bounds = CloudMade::BBox.from_coordinates(data['bounds']) if data.has_key? 'bounds' end |
Instance Attribute Details
#bounds ⇒ Object
Bounds of result set
97 98 99 |
# File 'lib/geocoding.rb', line 97 def bounds @bounds end |
#found ⇒ Object
Founded results
93 94 95 |
# File 'lib/geocoding.rb', line 93 def found @found end |
#results ⇒ Object
List of found GeoResult objects
95 96 97 |
# File 'lib/geocoding.rb', line 95 def results @results end |
Instance Method Details
#to_s ⇒ Object
107 108 109 |
# File 'lib/geocoding.rb', line 107 def to_s results.join(',') if results != nil end |