Module: MoneyAttribute::QueryHelpers Private
- Included in:
- QueryMethods
- Defined in:
- lib/money_attribute/query/helpers.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Internal helpers shared by the query sub-modules.
Instance Method Summary collapse
-
#extract_money_row(row, specs) ⇒ Array
private
Extracts money values for all specs from a single result row.
-
#money_attribute_spec!(attr) ⇒ AttributeSpec
private
Returns the registered money attribute spec or raises when missing.
Instance Method Details
#extract_money_row(row, specs) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extracts money values for all specs from a single result row.
27 28 29 30 31 32 33 34 |
# File 'lib/money_attribute/query/helpers.rb', line 27 def extract_money_row(row, specs) cursor = 0 specs.map do |spec| value, cursor = extract_attribute_value(row, spec, cursor) value end end |
#money_attribute_spec!(attr) ⇒ AttributeSpec
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the registered money attribute spec or raises when missing.
14 15 16 17 18 19 |
# File 'lib/money_attribute/query/helpers.rb', line 14 def money_attribute_spec!(attr) spec = klass.money_attribute_spec(attr) raise ArgumentError, "#{attr} is not a money attribute on #{klass.name}" unless spec spec end |