Class: Stepper::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hash_walker/stepper_base.rb

Direct Known Subclasses

Array, Hash

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blockObject

Returns the value of attribute block.



3
4
5
# File 'lib/hash_walker/stepper_base.rb', line 3

def block
  @block
end

#hash_fragmentObject

Returns the value of attribute hash_fragment.



3
4
5
# File 'lib/hash_walker/stepper_base.rb', line 3

def hash_fragment
  @hash_fragment
end

Instance Method Details

#step!Object



5
6
7
8
9
10
11
12
# File 'lib/hash_walker/stepper_base.rb', line 5

def step!
  if @block
    walker = HashWalker::Walker.new(:hash => @hash_fragment, :block => @block)
    walker.walk!
  else
    @hash_fragment
  end
end