Class: Gm::Notepad::Pad

Inherits:
Object
  • Object
show all
Defined in:
lib/gm/notepad/pad.rb

Overview

Responsible for recording entries and then dumping them accordingly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**config) ⇒ Pad

Returns a new instance of Pad.



6
7
8
9
10
11
12
# File 'lib/gm/notepad/pad.rb', line 6

def initialize(**config)
  self.config = config
  self.table_registry = config.fetch(:table_registry) { default_table_registry }
  self.renderer = config.fetch(:renderer) { default_renderer }
  self.input_processor = config.fetch(:input_processor) { default_input_processor }
  open!
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



5
6
7
# File 'lib/gm/notepad/pad.rb', line 5

def config
  @config
end

#table_registryObject

Returns the value of attribute table_registry.



24
25
26
# File 'lib/gm/notepad/pad.rb', line 24

def table_registry
  @table_registry
end

Instance Method Details

#close!Object



20
21
22
# File 'lib/gm/notepad/pad.rb', line 20

def close!
  @renderer.close!
end

#process(input:) ⇒ Object



14
15
16
17
18
# File 'lib/gm/notepad/pad.rb', line 14

def process(input:)
  input_processor.process(input: input) do |*args|
    renderer.call(*args)
  end
end