Sha256: 1cfaea7a64d2a92def90882e0860e983fe52fa734a3b667bafa484adc5eca5a0
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
require 'vedeu/support/esc' require 'vedeu/models/colour' module Vedeu module Helpers def foreground(value, &block) @output = '' @output << Esc.foreground_colour(value) @output << block.call if block_given? @output end alias_method :fg, :foreground def background(value, &block) @output = '' @output << Esc.background_colour(value) @output << block.call if block_given? @output end alias_method :bg, :background def colour(attributes = {}, &block) @output = '' @output << Colour.new(attributes).to_s @output << block.call if block_given? @output end def style(*value_or_values, &block) @output = '' if value_or_values.one? @output << Esc.string(value_or_values.first) @output << block.call if block_given? else @output << value_or_values.map do |s| Esc.string(s) end.join @output << block.call if block_given? end @output end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.1.2 | lib/vedeu/support/helpers.rb |
vedeu-0.1.1 | lib/vedeu/support/helpers.rb |