Class: Gm::Notepad::LineEvaluator

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

Overview

Responsible for recording entries and then dumping them accordingly.

Constant Summary collapse

TABLE_NAME_REGEXP =
%r{(?<table_name_container>\{(?<table_name>[^\{\}]+)\})}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_registry:) ⇒ LineEvaluator

Returns a new instance of LineEvaluator.



7
8
9
# File 'lib/gm/notepad/line_evaluator.rb', line 7

def initialize(table_registry:)
  @table_registry = table_registry
end

Instance Attribute Details

#table_registryObject (readonly)

Returns the value of attribute table_registry.



10
11
12
# File 'lib/gm/notepad/line_evaluator.rb', line 10

def table_registry
  @table_registry
end

Instance Method Details

#call(line:, expand_line: true) ⇒ Object



13
14
15
16
17
# File 'lib/gm/notepad/line_evaluator.rb', line 13

def call(line:, expand_line: true)
  return line unless expand_line
  text = parse_table(text: line)
  parse_dice(text: text)
end