Class: DroneApi::GeoJson
- Inherits:
-
Object
- Object
- DroneApi::GeoJson
- Defined in:
- lib/drone_api/geo_json.rb
Instance Attribute Summary collapse
-
#coordinates ⇒ Object
Returns the value of attribute coordinates.
-
#properties ⇒ Object
Returns the value of attribute properties.
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(properties = {}, coordinates = []) ⇒ GeoJson
constructor
A new instance of GeoJson.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(properties = {}, coordinates = []) ⇒ GeoJson
Returns a new instance of GeoJson.
5 6 7 8 |
# File 'lib/drone_api/geo_json.rb', line 5 def initialize(properties={}, coordinates=[]) @properties = properties @coordinates = coordinates end |
Instance Attribute Details
#coordinates ⇒ Object
Returns the value of attribute coordinates.
3 4 5 |
# File 'lib/drone_api/geo_json.rb', line 3 def coordinates @coordinates end |
#properties ⇒ Object
Returns the value of attribute properties.
3 4 5 |
# File 'lib/drone_api/geo_json.rb', line 3 def properties @properties end |
Class Method Details
Instance Method Details
#[](key) ⇒ Object
10 11 12 |
# File 'lib/drone_api/geo_json.rb', line 10 def [](key) @properties[key] end |
#[]=(key, value) ⇒ Object
14 15 16 |
# File 'lib/drone_api/geo_json.rb', line 14 def []=(key, value) @properties[key] = value end |
#to_json(*a) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/drone_api/geo_json.rb', line 18 def to_json(*a) { "type" => "Feature", "properties" => @properties, "geometry" => { "type" => "Point", "coordinates" => @coordinates } }.to_json(a) end |