Class: MetraSchedule::Stop
- Inherits:
-
Object
- Object
- MetraSchedule::Stop
- Defined in:
- lib/metra/stop.rb
Instance Attribute Summary collapse
-
#station ⇒ Object
readonly
Returns the value of attribute station.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Stop
constructor
A new instance of Stop.
- #is_after?(time) ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Stop
Returns a new instance of Stop.
5 6 7 8 9 10 11 |
# File 'lib/metra/stop.rb', line 5 def initialize(={}) unless .has_key?(:station) and .has_key?(:time) raise ArgumentError.new "Stop objects must have a station and a time" end @station = [:station] if .has_key?(:station) @time = [:time] if .has_key?(:time) end |
Instance Attribute Details
#station ⇒ Object (readonly)
Returns the value of attribute station.
3 4 5 |
# File 'lib/metra/stop.rb', line 3 def station @station end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
3 4 5 |
# File 'lib/metra/stop.rb', line 3 def time @time end |
Class Method Details
.pretty_print(sym) ⇒ Object
17 18 19 |
# File 'lib/metra/stop.rb', line 17 def self.pretty_print(sym) sym.to_s.split("_").map {|s| s.capitalize}.join("\s") end |
Instance Method Details
#is_after?(time) ⇒ Boolean
13 14 15 |
# File 'lib/metra/stop.rb', line 13 def is_after?(time) @time > time end |