Class: ActsAsCalculatorEditor::CastEntryRows

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_calculator_editor/cast_entry_rows.rb

Overview

Form rows in, the entries list an import document's lookup_tables section takes out.

from and to are nullable on both ends — an empty field means an unbounded bracket, not zero — so blanks become nil rather than being cast. value is required and is left as the operator typed it: ImportLookupTable runs every bound through CastDecimal, which is the one place a decimal is parsed.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rows) ⇒ CastEntryRows

Returns a new instance of CastEntryRows.



15
16
17
# File 'lib/acts_as_calculator_editor/cast_entry_rows.rb', line 15

def initialize(rows)
  @rows = rows
end

Class Method Details

.callObject



11
12
13
# File 'lib/acts_as_calculator_editor/cast_entry_rows.rb', line 11

def self.call(...)
  new(...).call
end

Instance Method Details

#callObject



19
20
21
# File 'lib/acts_as_calculator_editor/cast_entry_rows.rb', line 19

def call
  normalized_rows.filter_map { |row| entry(row) }
end