Sha256: 2902712bdb1ed5aaa5ab6c60983e2a24ce979f21e869f18e5d2e701845939b9c

Contents?: true

Size: 520 Bytes

Versions: 53

Compression:

Stored size: 520 Bytes

Contents

module AzaharaSchemaCurrency
  module PresenterPatch

    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

53 entries across 53 versions & 1 rubygems

Version Path
egov_utils-1.5.0.alpha16 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha15 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha14 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha13 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha12 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha11 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha10 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha9 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha8 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha7 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha6 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha5 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha4 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.4.5 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.4.4 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha3 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha2 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.5.0.alpha1 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.4.3 lib/azahara_schema_currency/presenter_patch.rb
egov_utils-1.4.2 lib/azahara_schema_currency/presenter_patch.rb