Class: RVGP::Pta::RegisterPosting

Inherits:
Base::Reader show all
Defined in:
lib/rvgp/pta.rb

Overview

A posting, as output by the ‘register’ command. Typically these are available as items in a transaction, via the RVGP::Pta::RegisterTransaction#postings method.

Instance Attribute Summary collapse

Attributes inherited from Base::Reader

#options

Instance Method Summary collapse

Methods inherited from Base::Reader

readers

Instance Attribute Details

#accountString (readonly)

The account this posting was assigned to

Returns:

  • (String)

    the current value of account



61
62
63
# File 'lib/rvgp/pta.rb', line 61

def 
  @account
end

#amountsArray<RVGP::Journal::Commodity> (readonly)

The commodities that were encountered in the amount column

Returns:



61
62
63
# File 'lib/rvgp/pta.rb', line 61

def amounts
  @amounts
end

#tagsHash<String,<String,TrueClass>> (readonly)

A hash containing the tags that were encountered in this posting. Values are either the string that was encountered, for this tag. Or, true, if no specific string value was assigned

Returns:

  • (Hash<String,<String,TrueClass>>)

    the current value of tags



61
62
63
# File 'lib/rvgp/pta.rb', line 61

def tags
  @tags
end

#totalsArray<RVGP::Journal::Commodity> (readonly)

The commodities that were encountered in the total column

Returns:



61
62
63
# File 'lib/rvgp/pta.rb', line 61

def totals
  @totals
end

Instance Method Details

#amount_in(code) ⇒ RVGP::Journal::Commodity

This method will return the sum of all commodities in the amount column, in the specified currency.

Parameters:

  • code (String)

    A three digit currency code, or currency symbol, in which you want to express the amount

Returns:



67
68
69
# File 'lib/rvgp/pta.rb', line 67

def amount_in(code)
  commodities_sum amounts, code
end

#total_in(code) ⇒ RVGP::Journal::Commodity

This method will return the sum of all commodities in the total column, in the specified currency.

Parameters:

  • code (String)

    A three digit currency code, or currency symbol, in which you want to express the total

Returns:



74
75
76
# File 'lib/rvgp/pta.rb', line 74

def total_in(code)
  commodities_sum totals, code
end