Sha256: 62d9985baa63f6d615b4a77556283941107c572166937281a6755c123ee5bd73

Contents?: true

Size: 915 Bytes

Versions: 38

Compression:

Stored size: 915 Bytes

Contents

# frozen_string_literal: true

module Boxcars
  # Train's action to take.
  class TrainAction
    attr_accessor :boxcar, :boxcar_input, :log

    # record for a train action
    # @param boxcar [String] The boxcar to run.
    # @param log [String] The log of the action.
    # @param boxcar_input [String] The input to the boxcar.
    # @return [Boxcars::TrainAction] The train action.
    def initialize(boxcar:, log:, boxcar_input: nil)
      @boxcar_input = boxcar_input
      @boxcar = boxcar
      @log = log
    end

    # build a train action from a result
    # @param result [Boxcars::Result] The result to build from.
    # @param boxcar [String] The boxcar to run.
    # @param log [String] The log of the action.
    # @return [Boxcars::TrainAction] The train action.
    def self.from_result(result:, boxcar:, log:)
      new(boxcar: boxcar, boxcar_input: result.to_answer, log: log)
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
boxcars-0.6.6 lib/boxcars/train/train_action.rb
boxcars-0.6.5 lib/boxcars/train/train_action.rb
boxcars-0.6.4 lib/boxcars/train/train_action.rb
boxcars-0.6.3 lib/boxcars/train/train_action.rb
boxcars-0.6.2 lib/boxcars/train/train_action.rb
boxcars-0.6.1 lib/boxcars/train/train_action.rb
boxcars-0.5.1 lib/boxcars/train/train_action.rb
boxcars-0.4.10 lib/boxcars/train/train_action.rb
boxcars-0.4.9 lib/boxcars/train/train_action.rb
boxcars-0.4.8 lib/boxcars/train/train_action.rb
boxcars-0.4.7 lib/boxcars/train/train_action.rb
boxcars-0.4.6 lib/boxcars/train/train_action.rb
boxcars-0.4.5 lib/boxcars/train/train_action.rb
boxcars-0.4.4 lib/boxcars/train/train_action.rb
boxcars-0.4.3 lib/boxcars/train/train_action.rb
boxcars-0.4.2 lib/boxcars/train/train_action.rb
boxcars-0.4.1 lib/boxcars/train/train_action.rb
boxcars-0.4.0 lib/boxcars/train/train_action.rb
boxcars-0.3.5 lib/boxcars/train/train_action.rb
boxcars-0.3.4 lib/boxcars/train/train_action.rb