Class: Money::Currency
- Inherits:
-
Object
- Object
- Money::Currency
- Includes:
- CurrencyExtend
- Defined in:
- lib/gera/money_support.rb
Class Method Summary collapse
- .all_crypto ⇒ Object
- .find!(query) ⇒ Object
-
.find_by_local_id(local_id) ⇒ Object
TODO Вынести в app.
Instance Method Summary collapse
Class Method Details
.all_crypto ⇒ Object
70 71 72 |
# File 'lib/gera/money_support.rb', line 70 def self.all_crypto @all_crypto ||= all.select(&:is_crypto?) end |
.find!(query) ⇒ Object
56 57 58 |
# File 'lib/gera/money_support.rb', line 56 def self.find!(query) find(query) || raise("No found currency (#{query.inspect})") end |
.find_by_local_id(local_id) ⇒ Object
TODO Вынести в app
62 63 64 65 66 67 68 |
# File 'lib/gera/money_support.rb', line 62 def self.find_by_local_id(local_id) local_id = local_id.to_i id, _ = self.table.find{|key, currency| currency[:local_id] == local_id} new(id) rescue UnknownCurrency nil end |
Instance Method Details
#zero_money ⇒ Object
74 75 76 |
# File 'lib/gera/money_support.rb', line 74 def zero_money Money.from_amount(0, self) end |