Class: Google::Maps::DistanceMatrix

Inherits:
Object
  • Object
show all
Defined in:
lib/google_maps/distance_matrix.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to, options = {}) ⇒ DistanceMatrix

Returns a new instance of DistanceMatrix.



10
11
12
13
14
15
# File 'lib/google_maps/distance_matrix.rb', line 10

def initialize(from, to, options = {})
  options = { language: options } unless options.is_a? Hash
  @from = from
  @to = to
  @options = { language: :en }.merge(options)
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



8
9
10
# File 'lib/google_maps/distance_matrix.rb', line 8

def from
  @from
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/google_maps/distance_matrix.rb', line 8

def options
  @options
end

#toObject

Returns the value of attribute to.



8
9
10
# File 'lib/google_maps/distance_matrix.rb', line 8

def to
  @to
end

Instance Method Details

#distanceObject



17
18
19
# File 'lib/google_maps/distance_matrix.rb', line 17

def distance
  element.distance.value
end

#durationObject



21
22
23
# File 'lib/google_maps/distance_matrix.rb', line 21

def duration
  element.duration.value
end