Module: BlankEmptyNilFilters::FilterMethods
- Included in:
- ArrayExtensions, HashExtensions
- Defined in:
- lib/blank_empty_nil_filters.rb
Overview
These filter methods are used on both the Array and Hash extensions
Instance Method Summary collapse
- #maybe_apply(val, condition, start, depth, level) ⇒ Object
- #maybe_recurse(val, scanner, condition, start, depth, level) ⇒ Object
Instance Method Details
#maybe_apply(val, condition, start, depth, level) ⇒ Object
20 21 22 |
# File 'lib/blank_empty_nil_filters.rb', line 20 def maybe_apply(val, condition, start, depth, level) val.send(condition) if level >= start && (depth.nil? || level < depth) end |
#maybe_recurse(val, scanner, condition, start, depth, level) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/blank_empty_nil_filters.rb', line 8 def maybe_recurse(val, scanner, condition, start, depth, level) if level >= start && (depth.nil? || level < depth) if val.respond_to?(scanner) val.send(scanner, condition, start, depth, level+1) # recurse else val end else val end end |