Sha256: 2a5320861fbe3e457e5bc071239719803a71edc265f60fed39bae94d315f684a

Contents?: true

Size: 523 Bytes

Versions: 12

Compression:

Stored size: 523 Bytes

Contents

module AzaharaSchemaCurrency
  module AttributeFormatterPatch

    def format_value_html(attribute, unformated_value, **options)
      case attribute.type
      when 'currency'
        Money.new(unformated_value, options[:currency_code].to_s.upercase.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

12 entries across 12 versions & 1 rubygems

Version Path
egov_utils-0.4.4 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.4.3 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.4.2 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.4.1 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.3.12 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.3.10 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.3.9 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.3.8 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.3.7 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.3.6 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.3.5 lib/azahara_schema_currency/attribute_formatter_patch.rb
egov_utils-0.3.4 lib/azahara_schema_currency/attribute_formatter_patch.rb