Module: Enumerable
- Defined in:
- lib/everythingrb/core/enumerable.rb
Instance Method Summary collapse
-
#join_map(join_with = "", with_index: false) {|element, index| ... } ⇒ String
Combines filter_map and join operations.
Instance Method Details
#join_map(join_with = "", with_index: false) {|element, index| ... } ⇒ String
Combines filter_map and join operations
28 29 30 31 32 33 34 35 36 |
# File 'lib/everythingrb/core/enumerable.rb', line 28 def join_map(join_with = "", with_index: false, &block) block = ->(i) { i } if block.nil? if with_index filter_map.with_index(&block).join(join_with) else filter_map(&block).join(join_with) end end |