Sha256: fb13f349c2b684c40ecc4ad892a0eadd524dc764238ce365d8b36f1ef7b10708

Contents?: true

Size: 1.07 KB

Versions: 12

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

# The Money element has three possible attributes: currency, alternateAmount,
# alternateCurrency. The attributes currency and alternateCurrecy must be a three-letter ISO
# 4217 currency code. The content of the Money element and of the aternateAmount
# attribute should be a numeric value. For example:
# <Money currency="USD">12.34</Money>
# The optional alternateCurrency and alternateAmount attributes are used together to specify
# an amount in an alternate currency. These can be used to support dual-currency
# requirements such as the euro. For example:
# <Money currency="USD" alternateCurrency=”EUR” alternateAmount=”14.28”>12.34
# </Money>
# Note:  You can optionally use commas as thousands separators. Do not use
# commas as decimal separators.
#
# Page: 59
# <Money currency="GBP">5.35</Money>

module CXML
  class Money < DocumentNode
    accessible_attributes %i[
      alternate_amount
      alternate_currency
      currency
    ]

    def amount
      content
    end

    def amount=(value)
      self.content = value
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cxml-ruby-0.8.2 lib/cxml/money.rb
cxml-ruby-0.8.1 lib/cxml/money.rb
cxml-ruby-0.8.0 lib/cxml/money.rb
cxml-ruby-0.7.0 lib/cxml/money.rb
cxml-ruby-0.6.1 lib/cxml/money.rb
cxml-ruby-0.6.0 lib/cxml/money.rb
cxml-ruby-0.5.0 lib/cxml/money.rb
cxml-ruby-0.4.1 lib/cxml/money.rb
cxml-ruby-0.4.0 lib/cxml/money.rb
cxml-ruby-0.3.0 lib/cxml/money.rb
cxml-ruby-0.2.1 lib/cxml/money.rb
cxml-ruby-0.2.0 lib/cxml/money.rb