Class: Gm::Notepad::InputHandlers::DefaultHandler
- Inherits:
-
Object
- Object
- Gm::Notepad::InputHandlers::DefaultHandler
- Defined in:
- lib/gm/notepad/input_handlers/default_handler.rb
Direct Known Subclasses
CommentHandler, HelpHandler, QueryTableHandler, QueryTableNamesHandler, WriteLineHandler, WriteToTableHandler
Instance Attribute Summary collapse
-
#expand_line ⇒ Object
(also: #expand_line?)
Returns the value of attribute expand_line.
-
#input ⇒ Object
Returns the value of attribute input.
-
#table_registry ⇒ Object
Returns the value of attribute table_registry.
-
#to_filesystem ⇒ Object
Returns the value of attribute to_filesystem.
-
#to_interactive ⇒ Object
Returns the value of attribute to_interactive.
-
#to_output ⇒ Object
Returns the value of attribute to_output.
Class Method Summary collapse
Instance Method Summary collapse
- #after_initialize! ⇒ Object
- #each_line_with_parameters ⇒ Object
-
#initialize(input:, table_registry: nil) ⇒ DefaultHandler
constructor
A new instance of DefaultHandler.
- #lines ⇒ Object
Constructor Details
#initialize(input:, table_registry: nil) ⇒ DefaultHandler
Returns a new instance of DefaultHandler.
14 15 16 17 18 19 20 21 22 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 14 def initialize(input:, table_registry: nil) self.to_interactive = false self.to_output = false self.to_filesystem = false self. = false self.input = input self.table_registry = table_registry after_initialize! end |
Instance Attribute Details
#expand_line ⇒ Object Also known as: expand_line?
Returns the value of attribute expand_line.
23 24 25 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 23 def end |
#input ⇒ Object
Returns the value of attribute input.
23 24 25 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 23 def input @input end |
#table_registry ⇒ Object
Returns the value of attribute table_registry.
23 24 25 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 23 def table_registry @table_registry end |
#to_filesystem ⇒ Object
Returns the value of attribute to_filesystem.
23 24 25 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 23 def to_filesystem @to_filesystem end |
#to_interactive ⇒ Object
Returns the value of attribute to_interactive.
23 24 25 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 23 def to_interactive @to_interactive end |
#to_output ⇒ Object
Returns the value of attribute to_output.
23 24 25 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 23 def to_output @to_output end |
Class Method Details
.build_if_handled(input:) ⇒ Object
5 6 7 8 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 5 def self.build_if_handled(input:) return false unless handles?(input: input) new(input: input) end |
.handles?(input:) ⇒ Boolean
10 11 12 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 10 def self.handles?(input:) true end |
Instance Method Details
#after_initialize! ⇒ Object
25 26 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 25 def after_initialize! end |
#each_line_with_parameters ⇒ Object
34 35 36 37 38 39 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 34 def each_line_with_parameters lines.each do |line| line = table_registry.evaluate(line: line.to_s.strip) if yield(line, to_output: to_output, to_interactive: to_interactive) end end |
#lines ⇒ Object
28 29 30 |
# File 'lib/gm/notepad/input_handlers/default_handler.rb', line 28 def lines [] end |