module AzaharaSchemaCurrency::PresenterPatch

Public Instance Methods

format_value_html(attribute, unformated_value, **options) click to toggle source
Calls superclass method
# File lib/azahara_schema_currency/presenter_patch.rb, line 4
def format_value_html(attribute, unformated_value, **options)
  case attribute.type
  when 'currency'
    Money.from_amount(unformated_value, options[:currency_code].to_s.upcase.presence).format
  else
    super
  end
end
formatting_options(attribute, entity) click to toggle source
Calls superclass method
# File lib/azahara_schema_currency/presenter_patch.rb, line 14
def formatting_options(attribute, entity)
  case attribute.type
  when 'currency'
    {currency_code: attribute.currency_code(entity).to_s}
  else
    super
  end
end