Class: CloudMade::GeoResults
- Inherits:
-
Object
- Object
- CloudMade::GeoResults
- Defined in:
- lib/cloudmade/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.
100 101 102 103 104 105 106 |
# File 'lib/cloudmade/geocoding.rb', line 100 def initialize(data) self.found = Integer(data['found']) if data.has_key? '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
98 99 100 |
# File 'lib/cloudmade/geocoding.rb', line 98 def bounds @bounds end |
#found ⇒ Object
Founded results
94 95 96 |
# File 'lib/cloudmade/geocoding.rb', line 94 def found @found end |
#results ⇒ Object
List of found GeoResult objects
96 97 98 |
# File 'lib/cloudmade/geocoding.rb', line 96 def results @results end |
Instance Method Details
#to_s ⇒ Object
108 109 110 |
# File 'lib/cloudmade/geocoding.rb', line 108 def to_s results.join(',') if results != nil end |