Class: Shellfie::Line
- Inherits:
-
Object
- Object
- Shellfie::Line
- Defined in:
- lib/shellfie/parser.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#command_color ⇒ Object
readonly
Returns the value of attribute command_color.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#output_color ⇒ Object
readonly
Returns the value of attribute output_color.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#prompt_color ⇒ Object
readonly
Returns the value of attribute prompt_color.
-
#selected ⇒ Object
readonly
Returns the value of attribute selected.
Instance Method Summary collapse
-
#initialize(prompt: nil, command: nil, output: nil, prompt_color: nil, command_color: nil, output_color: nil, selected: false) ⇒ Line
constructor
A new instance of Line.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(prompt: nil, command: nil, output: nil, prompt_color: nil, command_color: nil, output_color: nil, selected: false) ⇒ Line
Returns a new instance of Line.
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/shellfie/parser.rb', line 120 def initialize(prompt: nil, command: nil, output: nil, prompt_color: nil, command_color: nil, output_color: nil, selected: false) @prompt = prompt @command = command @output = output @prompt_color = prompt_color @command_color = command_color @output_color = output_color @selected = selected freeze end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
118 119 120 |
# File 'lib/shellfie/parser.rb', line 118 def command @command end |
#command_color ⇒ Object (readonly)
Returns the value of attribute command_color.
118 119 120 |
# File 'lib/shellfie/parser.rb', line 118 def command_color @command_color end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
118 119 120 |
# File 'lib/shellfie/parser.rb', line 118 def output @output end |
#output_color ⇒ Object (readonly)
Returns the value of attribute output_color.
118 119 120 |
# File 'lib/shellfie/parser.rb', line 118 def output_color @output_color end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
118 119 120 |
# File 'lib/shellfie/parser.rb', line 118 def prompt @prompt end |
#prompt_color ⇒ Object (readonly)
Returns the value of attribute prompt_color.
118 119 120 |
# File 'lib/shellfie/parser.rb', line 118 def prompt_color @prompt_color end |
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
118 119 120 |
# File 'lib/shellfie/parser.rb', line 118 def selected @selected end |
Instance Method Details
#to_h ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/shellfie/parser.rb', line 132 def to_h { prompt: prompt, command: command, output: output, prompt_color: prompt_color, command_color: command_color, output_color: output_color, selected: selected }.compact end |
#to_s ⇒ Object
144 145 146 |
# File 'lib/shellfie/parser.rb', line 144 def to_s [prompt, command, output].compact.join("\n") end |