Class: Subledger::Domain::Line

Direct Known Subclasses

ActiveLine, ArchivedLine, PostedLine

Defined Under Namespace

Classes: Entity

Instance Attribute Summary collapse

Attributes included from Roles::Versionable

#version

Attributes included from Roles::Storable

#client, #store

Attributes included from Roles::Identifiable

#id

Attributes included from Roles::Describable

#description, #reference

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Roles::Restable

#patch_hash, #post_hash, #serializable_hash, #to_json

Methods included from Roles::Collectable

included

Methods included from Roles::Readable

included, #read

Methods included from Roles::Creatable

#create, included

Methods included from Roles::Versionable

included

Methods included from Roles::Attributable

#attributes

Methods included from Subledger::Domain

#==, #collection_name, #entity_name, included, #to_s

Methods included from Value

#+, #==, included, #to_s

Constructor Details

#initialize(args) ⇒ Line

Returns a new instance of Line.



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/subledger/domain/line.rb', line 56

def initialize args
  describable args
  identifiable args
  storable args
  versionable args

  @journal_entry = args[:journal_entry]
  @account       = args[:account]
  @value         = args[:value]
  @order         = args[:order]

  specialized_initialization args
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



25
26
27
# File 'lib/subledger/domain/line.rb', line 25

def 
  @account
end

#journal_entryObject (readonly)

Returns the value of attribute journal_entry.



24
25
26
# File 'lib/subledger/domain/line.rb', line 24

def journal_entry
  @journal_entry
end

#orderObject

Returns the value of attribute order.



25
26
27
# File 'lib/subledger/domain/line.rb', line 25

def order
  @order
end

#valueObject

Returns the value of attribute value.



25
26
27
# File 'lib/subledger/domain/line.rb', line 25

def value
  @value
end

Class Method Details

.active_klassObject



39
40
41
# File 'lib/subledger/domain/line.rb', line 39

def self.active_klass
  ActiveLine
end

.archived_klassObject



35
36
37
# File 'lib/subledger/domain/line.rb', line 35

def self.archived_klass
  ArchivedLine
end

.posted_klassObject



43
44
45
# File 'lib/subledger/domain/line.rb', line 43

def self.posted_klass
  PostedLine
end

.root_klassObject



27
28
29
# File 'lib/subledger/domain/line.rb', line 27

def self.root_klass
  Line
end

.specialized_raise_unless_creatable(args) ⇒ Object



53
54
# File 'lib/subledger/domain/line.rb', line 53

def self.specialized_raise_unless_creatable args
end

.sub_klassesObject



31
32
33
# File 'lib/subledger/domain/line.rb', line 31

def self.sub_klasses
  [ archived_klass, active_klass, posted_klass ]
end

.update(args) ⇒ Object



47
48
49
50
51
# File 'lib/subledger/domain/line.rb', line 47

def self.update args
  raise_on_duplicate_orders args

  super
end

Instance Method Details

#amountObject



70
71
72
# File 'lib/subledger/domain/line.rb', line 70

def amount
  value.amount
end