Class: Gm::Notepad::App
- Inherits:
-
Object
- Object
- Gm::Notepad::App
- Extended by:
- Dry::Initializer
- Defined in:
- lib/gm/notepad/app.rb
Overview
Responsible for recording entries and then dumping them accordingly.
Instance Attribute Summary collapse
-
#input_processor ⇒ Object
readonly
Returns the value of attribute input_processor.
-
#renderer ⇒ Object
readonly
Returns the value of attribute renderer.
Instance Method Summary collapse
- #close! ⇒ Object
-
#initialize(*args, input_processor: nil, renderer: nil) ⇒ App
constructor
A new instance of App.
- #process(text:) ⇒ Object
Constructor Details
#initialize(*args, input_processor: nil, renderer: nil) ⇒ App
Returns a new instance of App.
16 17 18 19 20 21 |
# File 'lib/gm/notepad/app.rb', line 16 def initialize(*args, input_processor: nil, renderer: nil) super @renderer = renderer || LineRenderer.new(table_registry: table_registry) @input_processor = input_processor || InputProcessor.new(table_registry: table_registry) open! end |
Instance Attribute Details
#input_processor ⇒ Object (readonly)
Returns the value of attribute input_processor.
22 23 24 |
# File 'lib/gm/notepad/app.rb', line 22 def input_processor @input_processor end |
#renderer ⇒ Object (readonly)
Returns the value of attribute renderer.
22 23 24 |
# File 'lib/gm/notepad/app.rb', line 22 def renderer @renderer end |
Instance Method Details
#close! ⇒ Object
29 30 31 |
# File 'lib/gm/notepad/app.rb', line 29 def close! renderer.close! end |
#process(text:) ⇒ Object
24 25 26 27 |
# File 'lib/gm/notepad/app.rb', line 24 def process(text:) output = input_processor.convert_to_output(input: text) renderer.render(output: output) end |