class RockBooks::AccountType

Constants

ALL_TYPES
ASSET
EQUITY
EXPENSE
INCOME
LETTER_TO_TYPE
LIABILITY
SYMBOL_TO_TYPE

Public Class Methods

letter_to_type(string) click to toggle source

Converts type upper case letter representation to a type object (e.g. 'A' => ASSET)

# File lib/rock_books/types/account_type.rb, line 32
def self.letter_to_type(string)
  key = string[0].upcase
  LETTER_TO_TYPE.fetch(key) do
    raise Error.new("Account type of #{string} not valid. " +
        "Must be one of #{LETTER_TO_TYPE.keys} (#{ALL_TYPES.map(&:singular_name)})")
  end
end
symbol_to_type(symbol) click to toggle source
# File lib/rock_books/types/account_type.rb, line 40
def self.symbol_to_type(symbol)
  SYMBOL_TO_TYPE[symbol]
end