Class: Subledger::Domain::ActiveJournalEntry

Inherits:
JournalEntry show all
Includes:
Roles::Activatable, Roles::Archivable, Roles::Postable
Defined in:
lib/subledger/domain/journal_entry.rb

Defined Under Namespace

Classes: Entity

Instance Attribute Summary collapse

Attributes inherited from JournalEntry

#book, #effective_at, #org, #post_delay

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::Archivable

#archive

Methods included from Roles::Activatable

#activate

Methods included from Roles::Postable

#post, #posted_klass, #posting_klass

Methods inherited from JournalEntry

active_klass, archived_klass, #balance, #balanced?, create_and_post, #initialize, #line, #lines, patch_keys, post_keys, posted_klass, posting_klass, root_klass

Methods included from Roles::Restable

#patch_hash, #post_hash, #serializable_hash, #to_json

Methods included from Roles::Collectable

included

Methods included from Roles::Progressable

#progress

Methods included from Roles::Updatable

included, #update

Methods included from Roles::Readable

included, #read

Methods included from Roles::Creatable

#create, included

Methods included from Roles::Versionable

included

Methods included from Roles::Storable

raise_unless_creatable

Methods included from Roles::Describable

raise_unless_creatable

Methods included from Roles::Attributable

#attributes

Methods included from Subledger::Domain

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

Constructor Details

This class inherits a constructor from Subledger::Domain::JournalEntry

Instance Attribute Details

#reasonObject (readonly)

Returns the value of attribute reason.



220
221
222
# File 'lib/subledger/domain/journal_entry.rb', line 220

def reason
  @reason
end

Class Method Details

.sub_klassesObject



228
229
230
# File 'lib/subledger/domain/journal_entry.rb', line 228

def self.sub_klasses
  [ active_klass ]
end

Instance Method Details

#create_line(args) ⇒ Object



232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/subledger/domain/journal_entry.rb', line 232

def create_line args
  args.merge! :client        => client,
              :journal_entry => self,
              :effective_at  => effective_at

  Line.raise_on_duplicate_orders args

  client.active_lines.validate_creatability args

  active_line = client.active_lines args

  store.create_line :line => active_line
end