Class: Metrorail::Location

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

Overview

A class representing a location (i.e. latitude/longitude)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lat, lon) ⇒ Location

Returns a new instance of Location.



18
19
20
21
# File 'lib/metrorail.rb', line 18

def initialize(lat, lon)
    @lat = lat
    @lon = lon
end

Instance Attribute Details

#latObject (readonly)

Returns the value of attribute lat.



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

def lat
  @lat
end

#lonObject (readonly)

Returns the value of attribute lon.



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

def lon
  @lon
end

Instance Method Details

#to_sObject



23
24
25
# File 'lib/metrorail.rb', line 23

def to_s
    return "<Location: #{@lat}, #{@lon}>"
end