Class: Camt::Amount
- Inherits:
-
Object
- Object
- Camt::Amount
- Defined in:
- lib/camt/amount.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #currency ⇒ Object
-
#initialize(xml_node) ⇒ Amount
constructor
A new instance of Amount.
- #sign ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(xml_node) ⇒ Amount
Returns a new instance of Amount.
6 7 8 |
# File 'lib/camt/amount.rb', line 6 def initialize(xml_node) @node = xml_node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
4 5 6 |
# File 'lib/camt/amount.rb', line 4 def node @node end |
Instance Method Details
#currency ⇒ Object
18 19 20 |
# File 'lib/camt/amount.rb', line 18 def currency node.at('./Amt').attribute('Ccy').value end |
#sign ⇒ Object
14 15 16 |
# File 'lib/camt/amount.rb', line 14 def sign node.at('./CdtDbtInd').text == 'DBIT' ? -1 : 1 end |
#value ⇒ Object
10 11 12 |
# File 'lib/camt/amount.rb', line 10 def value sign * BigDecimal.new(node.at('./Amt').text) end |