Sha256: 8d8c4d886ed1e59e4b6d2274458fc9dbb8edb91315776eaaf81e0686cb6cda2e

Contents?: true

Size: 433 Bytes

Versions: 2

Compression:

Stored size: 433 Bytes

Contents

class Train
  attr_reader :status, :code, :date, :message, :direction

  def initialize hash
    @status    = hash['TrainStatus']
    @longitude = hash['TrainLongitude'].to_f
    @latitude  = hash['TrainLatitude'].to_f
    @code      = hash['TrainCode']
    @date      = Date.parse hash['TrainDate']
    @message   = hash['PublicMessage']
    @direction = hash['Direction']
  end

  def location
    [@longitude,@latitude]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ierail-0.4.1 lib/train.rb
ierail-0.4.0 lib/train.rb