Module: AzaharaSchemaCurrency::PresenterPatch
- Defined in:
- lib/azahara_schema_currency/presenter_patch.rb
Instance Method Summary collapse
- #format_value_html(attribute, unformated_value, **options) ⇒ Object
- #formatting_options(attribute, entity) ⇒ Object
Instance Method Details
#format_value_html(attribute, unformated_value, **options) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/azahara_schema_currency/presenter_patch.rb', line 4 def format_value_html(attribute, unformated_value, **) case attribute.type when 'currency' Money.from_amount(unformated_value, [:currency_code].to_s.upcase.presence).format else super end end |
#formatting_options(attribute, entity) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/azahara_schema_currency/presenter_patch.rb', line 14 def (attribute, entity) case attribute.type when 'currency' {currency_code: attribute.currency_code(entity).to_s} else super end end |