Module: Subledger::CollectionName

Defined in:
lib/subledger/collection_name.rb

Class Method Summary collapse

Class Method Details

.with_state(args) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# 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) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# 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..nil?
    :account_lines
  else
    klass.root_klass.collection_name
  end
end