Class: Boxcars::TrainAction
- Inherits:
-
Object
- Object
- Boxcars::TrainAction
- Defined in:
- lib/boxcars/train/train_action.rb
Overview
Train’s action to take.
Instance Attribute Summary collapse
-
#boxcar ⇒ Object
Returns the value of attribute boxcar.
-
#boxcar_input ⇒ Object
Returns the value of attribute boxcar_input.
-
#log ⇒ Object
Returns the value of attribute log.
Class Method Summary collapse
-
.from_result(result:, boxcar:, log:) ⇒ Boxcars::TrainAction
build a train action from a result.
Instance Method Summary collapse
-
#initialize(boxcar:, log:, boxcar_input: nil) ⇒ Boxcars::TrainAction
constructor
record for a train action.
Constructor Details
#initialize(boxcar:, log:, boxcar_input: nil) ⇒ Boxcars::TrainAction
record for a train action
13 14 15 16 17 |
# File 'lib/boxcars/train/train_action.rb', line 13 def initialize(boxcar:, log:, boxcar_input: nil) @boxcar_input = boxcar_input @boxcar = boxcar @log = log end |
Instance Attribute Details
#boxcar ⇒ Object
Returns the value of attribute boxcar.
6 7 8 |
# File 'lib/boxcars/train/train_action.rb', line 6 def boxcar @boxcar end |
#boxcar_input ⇒ Object
Returns the value of attribute boxcar_input.
6 7 8 |
# File 'lib/boxcars/train/train_action.rb', line 6 def boxcar_input @boxcar_input end |
#log ⇒ Object
Returns the value of attribute log.
6 7 8 |
# File 'lib/boxcars/train/train_action.rb', line 6 def log @log end |
Class Method Details
.from_result(result:, boxcar:, log:) ⇒ Boxcars::TrainAction
build a train action from a result
24 25 26 |
# File 'lib/boxcars/train/train_action.rb', line 24 def self.from_result(result:, boxcar:, log:) new(boxcar: boxcar, boxcar_input: result.to_answer, log: log) end |