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
153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/gemmy/patches/array_patch.rb', line 153 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 |