Class: Gm::Notepad::InputHandlers::WriteLineHandler
- Inherits:
-
DefaultHandler
- Object
- DefaultHandler
- Gm::Notepad::InputHandlers::WriteLineHandler
- Defined in:
- lib/gm/notepad/input_handlers/write_line_handler.rb
Constant Summary collapse
- NON_EXPANDING_CHARATER =
'!'.freeze
Instance Attribute Summary collapse
-
#line ⇒ Object
Returns the value of attribute line.
Attributes inherited from DefaultHandler
#expand_line, #input, #table_registry, #to_filesystem, #to_interactive, #to_output
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from DefaultHandler
build_if_handled, #each_line_with_parameters, #initialize
Constructor Details
This class inherits a constructor from Gm::Notepad::InputHandlers::DefaultHandler
Instance Attribute Details
#line ⇒ Object
Returns the value of attribute line.
12 13 14 |
# File 'lib/gm/notepad/input_handlers/write_line_handler.rb', line 12 def line @line end |
Class Method Details
.handles?(input:) ⇒ Boolean
8 9 10 |
# File 'lib/gm/notepad/input_handlers/write_line_handler.rb', line 8 def self.handles?(input:) true end |
Instance Method Details
#after_initialize! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gm/notepad/input_handlers/write_line_handler.rb', line 13 def after_initialize! self. = false self.to_output = true self.to_interactive = true if input[0] == NON_EXPANDING_CHARATER self.line = input[1..-1].strip self. = false else self.line = input.strip self. = true end end |
#lines ⇒ Object
26 27 28 |
# File 'lib/gm/notepad/input_handlers/write_line_handler.rb', line 26 def lines [line] end |