Class: Gm::Notepad::LineEvaluator
- Inherits:
-
Object
- Object
- Gm::Notepad::LineEvaluator
- 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
-
#table_registry ⇒ Object
readonly
Returns the value of attribute table_registry.
Instance Method Summary collapse
- #call(line:, expand_line: true) ⇒ Object
-
#initialize(table_registry:) ⇒ LineEvaluator
constructor
A new instance of LineEvaluator.
Constructor Details
#initialize(table_registry:) ⇒ LineEvaluator
Returns a new instance of LineEvaluator.
8 9 10 |
# File 'lib/gm/notepad/line_evaluator.rb', line 8 def initialize(table_registry:) @table_registry = table_registry end |
Instance Attribute Details
#table_registry ⇒ Object (readonly)
Returns the value of attribute table_registry.
11 12 13 |
# File 'lib/gm/notepad/line_evaluator.rb', line 11 def table_registry @table_registry end |
Instance Method Details
#call(line:, expand_line: true) ⇒ Object
14 15 16 17 18 |
# File 'lib/gm/notepad/line_evaluator.rb', line 14 def call(line:, expand_line: true) return line unless text = parse_table(text: line) parse_dice(text: text) end |