Class: Subledger::Domain::Category
- Inherits:
-
Object
- Object
- Subledger::Domain::Category
show all
- Includes:
- Subledger::Domain, Roles::Activatable, Roles::Archivable, Roles::Attributable, Roles::Collectable, Roles::Creatable, Roles::Describable, Roles::Identifiable, Roles::Readable, Roles::Restable, Roles::Storable, Roles::Updatable, Roles::Versionable
- Defined in:
- lib/subledger/domain/category.rb
Defined Under Namespace
Classes: Entity
Instance Attribute Summary collapse
#version
#client, #store
#id
#description, #reference
Class Method Summary
collapse
Instance Method Summary
collapse
#patch_hash, #post_hash, #serializable_hash, #to_json
#archive
#activate
included
included, #update
included, #read
#create, included
included
#attributes
#==, #collection_name, #entity_name, included, #to_s
Constructor Details
#initialize(args) ⇒ Category
Returns a new instance of Category.
53
54
55
56
57
58
59
60
61
|
# File 'lib/subledger/domain/category.rb', line 53
def initialize args
describable args
identifiable args
storable args
versionable args
@book = args[:book]
@normal_balance = args[:normal_balance]
end
|
Instance Attribute Details
#book ⇒ Object
Returns the value of attribute book.
26
27
28
|
# File 'lib/subledger/domain/category.rb', line 26
def book
@book
end
|
#normal_balance ⇒ Object
Returns the value of attribute normal_balance.
27
28
29
|
# File 'lib/subledger/domain/category.rb', line 27
def normal_balance
@normal_balance
end
|
Class Method Details
.active_klass ⇒ Object
45
46
47
|
# File 'lib/subledger/domain/category.rb', line 45
def self.active_klass
ActiveCategory
end
|
.archived_klass ⇒ Object
49
50
51
|
# File 'lib/subledger/domain/category.rb', line 49
def self.archived_klass
ArchivedCategory
end
|
.patch_keys ⇒ Object
33
34
35
|
# File 'lib/subledger/domain/category.rb', line 33
def self.patch_keys
[ :id, :description, :reference, :normal_balance, :version ]
end
|
.post_keys ⇒ Object
29
30
31
|
# File 'lib/subledger/domain/category.rb', line 29
def self.post_keys
[ :description, :reference, :normal_balance ]
end
|
.root_klass ⇒ Object
37
38
39
|
# File 'lib/subledger/domain/category.rb', line 37
def self.root_klass
Category
end
|
.sub_klasses ⇒ Object
41
42
43
|
# File 'lib/subledger/domain/category.rb', line 41
def self.sub_klasses
[ active_klass, archived_klass ]
end
|
Instance Method Details
#accounts(&block) ⇒ Object
63
64
65
66
67
68
69
|
# File 'lib/subledger/domain/category.rb', line 63
def accounts &block
begin
store.collect_accounts_for_category self, &block
rescue Store::CollectError => e
raise CategoryError, e
end
end
|