Class: NextTrain
- Inherits:
-
Object
- Object
- NextTrain
- Defined in:
- lib/next_train.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(stpid) ⇒ NextTrain
constructor
A new instance of NextTrain.
Constructor Details
#initialize(stpid) ⇒ NextTrain
Returns a new instance of NextTrain.
13 14 15 |
# File 'lib/next_train.rb', line 13 def initialize(stpid) @stpid = stpid end |
Class Method Details
.[](stpid) ⇒ Object
5 6 7 |
# File 'lib/next_train.rb', line 5 def self.[](stpid) new(stpid).execute end |
.api_key=(api_key) ⇒ Object
9 10 11 |
# File 'lib/next_train.rb', line 9 def self.api_key= (api_key) CTA::TrainTracker.key = api_key end |
Instance Method Details
#execute ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/next_train.rb', line 17 def execute if minutes_until_next_arrival == 0 "arriving" else arrival_time_in_minutes end end |