Sha256: 6af2d33479ad54ebfc327c6fe42de255ef3a5e69e1deb6896afff425d675df1c
Contents?: true
Size: 713 Bytes
Versions: 7
Compression:
Stored size: 713 Bytes
Contents
module StationMaster module Schedule class Arrival attr_reader :train_code, :train_type, :origin, :platform, :time, :delay def initialize(hash) @train_code = hash[:numeroTreno] @train_type = hash[:categoria] @origin = hash[:origine] @platform = (hash[:binarioProgrammatoArrivoDescrizione].to_s || '0').strip @time = Time.at((hash[:orarioArrivo] || 0) / 1000) @delay = hash[:ritardo] end def to_hash { train_code: train_code, train_type: train_type, origin: origin, platform: platform, time: time.strftime('%H:%M'), delay: delay } end end end end
Version data entries
7 entries across 7 versions & 1 rubygems