Module: Gemmy::Patches::ArrayPatch::InstanceMethods::Recurse
- Defined in:
- lib/gemmy/patches/array_patch.rb
Instance Method Summary collapse
Instance Method Details
#recurse(*types) {|a| ... } ⇒ Object
facets
140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/gemmy/patches/array_patch.rb', line 140 def recurse(*types, &block) types = [self.class] if types.empty? a = inject([]) do |array, value| case value when *types array << value.recurse(*types, &block) else array << value end array end yield a end |