Class: Mascot::Extensions::ProcManipulator

Inherits:
Object
  • Object
show all
Defined in:
lib/mascot/extensions/proc_manipulator.rb

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ ProcManipulator

Returns a new instance of ProcManipulator.



4
5
6
# File 'lib/mascot/extensions/proc_manipulator.rb', line 4

def initialize(block)
  @block = block
end

Instance Method Details

#process_resources(node) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/mascot/extensions/proc_manipulator.rb', line 8

def process_resources(node)
  node.flatten.each do |resource|
    if @block.arity == 1
      @block.call resource
    else # This will blow up if 0 or greater than 2.
      @block.call resource, node
    end
  end
end