Class: Methodical::SimpleActionItem

Inherits:
ActionItem show all
Extended by:
Forwardable
Defined in:
lib/methodical/simple_action_item.rb

Instance Attribute Summary

Attributes inherited from ActionItem

#disposition, #error, #ignored, #title, #walkthrough

Attributes included from Executable

#raise_on_error

Instance Method Summary collapse

Methods inherited from ActionItem

#abort!, #checkpoint!, #continue?, #decisive?, #fail!, #finish!, #human_status, #ignored?, #inspect, #relevant?, #skip!, #succeed!, #sufficient!, #synopsis, #to_s, #update!

Methods included from Executable

#catch_disposition, #execute!, #raise_on_error?

Constructor Details

#initialize(title, callable = nil, &block) ⇒ SimpleActionItem

Returns a new instance of SimpleActionItem.



7
8
9
10
11
12
13
# File 'lib/methodical/simple_action_item.rb', line 7

def initialize(title, callable=nil, &block)
  unless(!!callable ^ !!block)
    raise ArgumentError, "Either a callable or a block must be provided"
  end
  @block       = callable || block
  super(title)
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/methodical/simple_action_item.rb', line 19

def ==(other)
  self.block.eql?(other.block)
end

#call(baton, step) ⇒ Object



15
16
17
# File 'lib/methodical/simple_action_item.rb', line 15

def call(baton, step)
  @block.call(baton, step)
end