Class: GoogleGeocodings::Rectangle

Inherits:
Object
  • Object
show all
Defined in:
lib/google_geocodings/rectangle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bounds = {}) ⇒ Rectangle

Returns a new instance of Rectangle.

Parameters:

  • bounds (Hash) (defaults to: {})

    @bounds start_latitude [Float] @bounds start_longitude [Float] @bounds end_latitude [Float] @bounds end_longitude [Float]



9
10
11
12
13
14
15
16
17
# File 'lib/google_geocodings/rectangle.rb', line 9

def initialize(bounds = {})
  bounds ||= {}
  start_latitude  = bounds[:start_latitude]
  start_longitude = bounds[:start_longitude]
  end_latitude    = bounds[:end_latitude]
  end_longitude   = bounds[:end_longitude]
  return unless start_latitude && start_longitude && end_latitude && end_longitude
  @format = [[("%.8f" % start_latitude), ("%.8f" % start_longitude)].join(','), [("%.8f" % end_latitude), ("%.8f" % end_longitude)].join(',')].join('|')
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



3
4
5
# File 'lib/google_geocodings/rectangle.rb', line 3

def format
  @format
end