Class: Station

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Station

Returns a new instance of Station.



6
7
8
9
10
11
12
# File 'lib/station.rb', line 6

def initialize hash
  @description = hash['StationDesc']
  @latitude    = hash['StationLatitude'].to_f
  @longitude   = hash['StationLongitude'].to_f
  @code        = hash['StationCode']
  @id          = hash['StationId'].to_i
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/station.rb', line 4

def code
  @code
end

#descriptionObject (readonly) Also known as: name

Returns the value of attribute description.



4
5
6
# File 'lib/station.rb', line 4

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/station.rb', line 4

def id
  @id
end

Instance Method Details

#locationObject



14
15
16
# File 'lib/station.rb', line 14

def location
  [@longitude,@latitude]
end