Module: MoneyAttribute::PickAmount Private
- Included in:
- QueryMethods
- Defined in:
- lib/money_attribute/query/pick.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 pick resolution for the pick_amount query helper.
Instance Method Summary collapse
-
#pick_amount(*attrs) ⇒ Mint::Money, ...
private
Picks money-aware amounts for one or more attributes.
Instance Method Details
#pick_amount(*attrs) ⇒ Mint::Money, ...
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.
Picks money-aware amounts for one or more attributes.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/money_attribute/query/pick.rb', line 14 def pick_amount(*attrs) raise ArgumentError, 'No attribute specified' if attrs.empty? specs = attrs.map { |attr| money_attribute_spec!(attr) } return pick_single_amount(specs.first) if specs.length == 1 raw = pick(*specs.flat_map(&:columns)) return unless raw extract_money_row(raw, specs) end |