Module: TerminalMarkup::InstanceMethods
Instance Method Summary collapse
-
#escape ⇒ Object
for printing to console with escape codes intact.
-
#with_escape_code(code) ⇒ Object
returns the string wrapped in the supplied escape code.
Instance Method Details
#escape ⇒ Object
for printing to console with escape codes intact
78 79 80 |
# File 'lib/terminal_markup.rb', line 78 def escape eval '"'+ to_s.gsub(/\"/,'\"') + '"' end |
#with_escape_code(code) ⇒ Object
returns the string wrapped in the supplied escape code
73 74 75 |
# File 'lib/terminal_markup.rb', line 73 def with_escape_code(code) "\\e[#{code}m#{self.to_s}\\e[0m" end |