Class: TTY::Shell::Statement
- Inherits:
-
Object
- Object
- TTY::Shell::Statement
- Defined in:
- lib/tty/shell/statement.rb
Overview
A class representing a statement output to shell.
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#newline ⇒ Object
readonly
Returns the value of attribute newline.
Instance Method Summary collapse
-
#declare(message) ⇒ Object
Output the message to the shell.
-
#initialize(shell = nil, options = {}) ⇒ Statement
constructor
Initialize a Statement.
Constructor Details
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
15 16 17 |
# File 'lib/tty/shell/statement.rb', line 15 def color @color end |
#newline ⇒ Object (readonly)
Returns the value of attribute newline.
13 14 15 |
# File 'lib/tty/shell/statement.rb', line 13 def newline @newline end |
Instance Method Details
#declare(message) ⇒ Object
Output the message to the shell
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/tty/shell/statement.rb', line 42 def declare() = TTY::terminal.color.set , *color if color if newline && /( |\t)(\e\[\d+(;\d+)*m)?\Z/ !~ shell.output.puts else shell.output.print shell.output.flush end end |