Sha256: 594881fa4dc5e08db951e15f9db26b3e11668ef823786964e879ab7a5332eb2b

Contents?: true

Size: 529 Bytes

Versions: 7

Compression:

Stored size: 529 Bytes

Contents

module AzaharaSchemaCurrency
  module AttributeFormatterPatch

    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


    def formatting_options(attribute, entity)
      case attribute.type
      when 'currency'
        {currency_code: attribute.currency_code(entity).to_s}
      else
        super
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
egov_utils-0.4.14 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.4.13 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.4.10 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.4.9 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.4.7 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.4.6 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.4.5 lib/azahara_schema_currency/attribute_formatter_patch.rb