Class: CartoJson::Rectangle
- Inherits:
-
Object
- Object
- CartoJson::Rectangle
- Defined in:
- lib/carto_json/rectangle.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Rectangle
constructor
A new instance of Rectangle.
- #to_wkt ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Rectangle
Returns a new instance of Rectangle.
3 4 5 6 7 8 |
# File 'lib/carto_json/rectangle.rb', line 3 def initialize(opts={}) raise "sw and ne coordinates are required" unless opts[:sw] && opts[:ne] @sw = opts[:sw].to_f @ne = opts[:ne].to_f raise "sw and ne coordinates cannot be equal" if @sw == @ne end |
Instance Method Details
#to_wkt ⇒ Object
10 11 12 |
# File 'lib/carto_json/rectangle.rb', line 10 def to_wkt end |