Sha256: 62742eac7797b0aea267d1455304abf5f8bc73479bae1911e83b1b5e2f4b03ca
Contents?: true
Size: 901 Bytes
Versions: 48
Compression:
Stored size: 901 Bytes
Contents
module Bmg class Summarizer # # String concatenation summarizer. # # Example: # # # direct ruby usage # Bmg::Summarizer.concat(:qty).summarize(...) # class Concat < Summarizer # Sets default options. def default_options {:before => "", :after => "", :between => ""} end # Returns least value (defaults to "") def least() "" end # Concatenates current memo with val.to_s def _happens(memo, val) memo << options[:between].to_s unless memo.empty? memo << val.to_s end # Finalizes computation def finalize(memo) options[:before].to_s + memo + options[:after].to_s end end # class Concat # Factors a concatenation summarizer def self.concat(*args, &bl) Concat.new(*args, &bl) end end # class Summarizer end # module Bmg
Version data entries
48 entries across 48 versions & 1 rubygems