Class: CrayonString

Inherits:
String
  • Object
show all
Includes:
Crayon
Defined in:
lib/crayon/crayon_string.rb

Constant Summary

Constants included from Crayon

Crayon::COLORS, Crayon::FORMATS, Crayon::TERMINATION_STRING, Crayon::VERSION

Instance Method Summary collapse

Methods included from Crayon::StringBuilder

#background_string, #foreground_string, #formatting_string, #handle_color, #has_color?, #prepare_string

Methods included from Crayon::MethodParser

#parse_background, #parse_foreground, #parse_formatting, #parse_method_name

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, string) ⇒ Object



8
9
10
11
12
# File 'lib/crayon/crayon_string.rb', line 8

def method_missing(method_name, string)
  @method_name = method_name
  parse_method_name
  CrayonString.new(self + prepare_string(string))
end

Instance Method Details

#clear(string) ⇒ Object



4
5
6
# File 'lib/crayon/crayon_string.rb', line 4

def clear(string)
  CrayonString.new(self + string)
end