module Subledger::CollectionName

Public Class Methods

with_state(args) click to toggle source
# File lib/subledger/collection_name.rb, line 14
def self.with_state args
  klass = args[:klass]
  state = args[:state]

  if klass == Domain::PostedLine and not args[:account].nil?
    :account_lines
  else
    "#{state}_#{klass.root_klass.collection_name}".to_sym
  end
end
without_state(args) click to toggle source
# File lib/subledger/collection_name.rb, line 3
def self.without_state args
  anchor = args[:anchor]
  klass  = anchor.class

  if klass == Domain::PostedLine and not anchor.account.nil?
    :account_lines
  else
    klass.root_klass.collection_name
  end
end