### Home Classes Methods

### In Files

- lib/facets/enumerable/recursively.rb

### Parent

Object

### Methods

- ::new
- #method_missing

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Lazy
- Lazy::Future
- Lazy::Promise
- Lazy::Promise::DIVERGES
- Lazy::PromiseSafe
- Enumerable
- Enumerable::Recursor
- Method
- Method::Composition
- Module
- Module::InstanceFunction
- Array
- Binding
- Class
- Comparable
- Denumerable
- Denumerator
- Dir
- Enumerator
- Exception
- Facets
- FalseClass
- File
- FileTest
- Fixnum
- Float
- Functor
- Hash
- Indexable
- Instance
- Integer
- Kernel
- MatchData
- NA
- NilClass
- Numeric
- Object
- ObjectSpace
- Proc
- Process
- Range
- Regexp
- String
- Struct
- Symbol
- Time
- TrueClass
- UnboundMethod

No matching classes.

# Enumerable::Recursor

Recursor is a specialized Functor for recurively iterating over Enumerables.

### Public Class Methods

new(enum, *types, &block) click to toggle source

    # File lib/facets/enumerable/recursively.rb, line 20
    def initialize(enum, *types, &block)
      @enum   = enum
      @types  = types.empty? ? [@enum.class] : types
      @block  = block
    end

### Public Instance Methods

method_missing(op, &yld) click to toggle source

    # File lib/facets/enumerable/recursively.rb, line 26
    def method_missing(op, &yld)
      rec = @block || lambda{ |v| v }
      yld = yld    || lambda{ |v| v }  # ? to_enum
      @enum.__send__(op) do |v|
        case v
        when String # b/c of 1.8
          yld.call(v)
        when *@types
          res = v.recursively(*@types, &@block).__send__(op,&yld)
          rec.call(res)
        else
          yld.call(v)
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.