Module: Paintbrush

Defined in:
lib/paintbrush.rb,
lib/paintbrush/colors.rb,
lib/paintbrush/escapes.rb,
lib/paintbrush/version.rb,
lib/paintbrush/element_tree.rb,
lib/paintbrush/color_element.rb,
lib/paintbrush/colorized_string.rb,
lib/paintbrush/bounded_color_element.rb

Overview

Colorizes a string, provides ‘#paintbrush`. When included/extended in a class, call `#paintbrush` and pass a block to use the provided dynamically defined methods, e.g.:

“‘ruby class Foo

include Paintbrush

def bar
  puts paintbrush { cyan("hello #{green("there")}) }
end

“‘

Defined Under Namespace

Modules: Colors, Escapes Classes: BoundedColorElement, ColorElement, ColorizedString, ElementTree

Constant Summary collapse

VERSION =
'0.1.1'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.paintbrush(&block) ⇒ Object



23
24
25
# File 'lib/paintbrush.rb', line 23

def self.paintbrush(&block)
  ColorizedString.new(&block).colorized
end

Instance Method Details

#paintbrush(&block) ⇒ Object



27
28
29
# File 'lib/paintbrush.rb', line 27

def paintbrush(&block)
  Paintbrush.paintbrush(&block)
end