Sha256: 2b66baba636c46ed70644348d2be2cbecb7b0e5b60914e72b446cd31146e620c
Contents?: true
Size: 704 Bytes
Versions: 8
Compression:
Stored size: 704 Bytes
Contents
require 'pp' module Lino module Utilities def map_and_join(collection, &block) collection.map { |item| block.call(item) }.join(' ') end def join_with(global_separator) lambda do |item| item[:components].join(item[:separator] || global_separator) end end def quote_with(global_character) lambda do |item| character = item[:quoting] || global_character components = item[:components] switch = components[0] value = components[1] item.merge( components: (components.count > 1) ? [switch, "#{character}#{value}#{character}"] : components) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems