Module: Predicated::Unary::FlipThroughMe

Included in:
Predicated::Unary
Defined in:
lib/predicated/predicate.rb

Instance Method Summary collapse

Instance Method Details

#each(ancestors = []) {|[self, ancestors]| ... } ⇒ Object

Yields:

  • ([self, ancestors])


24
25
26
27
28
# File 'lib/predicated/predicate.rb', line 24

def each(ancestors=[], &block)
  yield([self, ancestors])
  ancestors_including_me = ancestors.dup + [self]
  inner.each(ancestors_including_me) { |item| block.call(item) } if inner.is_a?(Enumerable)
end