Sha256: 16a610aa9483a67d1c31d27f0eba8dfe3bb2815dda844223f29f82b341e18a33
Contents?: true
Size: 900 Bytes
Versions: 4
Compression:
Stored size: 900 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
bmg-0.23.3 | lib/bmg/summarizer/concat.rb |
bmg-0.23.2 | lib/bmg/summarizer/concat.rb |
bmg-0.23.1 | lib/bmg/summarizer/concat.rb |
bmg-0.23.0 | lib/bmg/summarizer/concat.rb |