Class: StepperMotor::Step

Inherits:
Object
  • Object
show all
Defined in:
lib/stepper_motor/step.rb

Overview

Describes a step in a journey. These objects get stored inside the step_definitions array of the Journey subclass. When the step gets performed, the block passed to the constructor will be instance_exec’d with the Journey model being the context

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, seq:, wait: 0, &step_block) ⇒ Step

Returns a new instance of Step.



6
7
8
9
10
11
# File 'lib/stepper_motor/step.rb', line 6

def initialize(name:, seq:, wait: 0, &step_block)
  @step_block = step_block
  @name = name.to_s
  @wait = wait
  @seq = seq
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/stepper_motor/step.rb', line 5

def name
  @name
end

#seqObject (readonly)

Returns the value of attribute seq.



5
6
7
# File 'lib/stepper_motor/step.rb', line 5

def seq
  @seq
end

#waitObject (readonly)

Returns the value of attribute wait.



5
6
7
# File 'lib/stepper_motor/step.rb', line 5

def wait
  @wait
end

Instance Method Details

#to_procObject

Makes the Step object itself callable



14
15
16
# File 'lib/stepper_motor/step.rb', line 14

def to_proc
  @step_block
end