Class: LedgerRest::Ledger::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/ledger-rest/ledger/entry.rb

Overview

Ledger offers a simple command to create a new entry based on previous entries in your ledger files. This class abstracts mentioned functionality for easy integration into ledger-rest.

Class Method Summary collapse

Class Method Details

.append(desc, options = {}) ⇒ Object

Appends a new transaction



16
17
18
19
20
# File 'lib/ledger-rest/ledger/entry.rb', line 16

def append(desc, options = {})
  transaction = get(desc, options)
  transaction.append_to(Ledger.append_file)
  transaction
end

.get(desc, options = {}) ⇒ Object

Return a new transaction object based on previous transactions.



10
11
12
13
# File 'lib/ledger-rest/ledger/entry.rb', line 10

def get(desc, options = {})
  result = Ledger.exec("entry #{desc}", options)
  Transaction.parse(result)
end