Ledger
public class Ledger
extension Ledger: CustomStringConvertible
extension Ledger: Equatable
A Ledger is the main part of the model, it contains all necessary information.
-
Array of all
Transaction
s in this ledgerDeclaration
Swift
public private(set) var transactions: [Transaction] { get }
-
Errors from the ledger and the parsing
Returns
ledgerErrors
andparsingErrors
Note: This property is computed, so please cache the resultDeclaration
Swift
public var errors: [String] { get }
-
Errors which this ledger contains
This includes failed balances assertions, … Note: This property is computed, so please cache the result
Declaration
Swift
public var ledgerErrors: [String] { get }
-
Errors while reading the ledger
This can be used by a parser to store errors which occurred while trying to fill in the ledger. The ledger itself will not put anything inside.
Declaration
Swift
public var parsingErrors: [String]
-
Array of the main
AccountGroup
s (all fiveAccountType
s) in this ledgerDeclaration
Swift
public var accountGroups: [AccountGroup] { get }
-
Array of all plugins
Declaration
Swift
public var plugins: [String]
-
Array of all options
Declaration
Swift
public var option: [Option]
-
Array of all events
Declaration
Swift
public var events: [Event]
-
Array of all Custom directives
Declaration
Swift
public var custom: [Custom]
-
Creates an empty ledger with the
accountGroups
set upDeclaration
Swift
public init()
-
Adds a
Transcaction
to the ledgerDeclaration
Swift
public func add(_ transaction: Transaction)
Parameters
transaction
transaction to add
-
Retuns the ledger file for this ledger.
It consists of all
Account
andTransaction
statements, but does not includeerrors
Declaration
Swift
public var description: String { get }
-
Compares two Ledgers
Compared are the
Account
s,Transaction
s,Commodity
s,Tag
s,Event
s,Custom
s, as welloption
s andplugins
, but not theerrors
Declaration
Swift
public static func == (lhs: Ledger, rhs: Ledger) -> Bool
Parameters
lhs
ledger one
rhs
ledger two
Return Value
true if they hold the same information, otherwise false