Class: Subledger::Domain::ReportRendering
- Inherits:
-
Object
- Object
- Subledger::Domain::ReportRendering
- Includes:
- Subledger::Domain, Subledger::Domain::Roles::Attributable, Subledger::Domain::Roles::Collectable, Subledger::Domain::Roles::Creatable, Subledger::Domain::Roles::DescribableReportRendering, Subledger::Domain::Roles::Identifiable, Subledger::Domain::Roles::Readable, Subledger::Domain::Roles::Restable, Subledger::Domain::Roles::Storable, Subledger::Domain::Roles::Timeable
- Defined in:
- lib/subledger/domain/report_rendering.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Entity
Instance Attribute Summary collapse
-
#balanced_accounts ⇒ Object
readonly
Returns the value of attribute balanced_accounts.
-
#book ⇒ Object
readonly
Returns the value of attribute book.
-
#effective_at ⇒ Object
readonly
Returns the value of attribute effective_at.
-
#rendered_at ⇒ Object
readonly
Returns the value of attribute rendered_at.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
-
#total_accounts ⇒ Object
readonly
Returns the value of attribute total_accounts.
Attributes included from Subledger::Domain::Roles::Storable
Attributes included from Subledger::Domain::Roles::Identifiable
Attributes included from Subledger::Domain::Roles::DescribableReportRendering
Class Method Summary collapse
-
.active_klass ⇒ Object
TODO create uses active_klass, should use creation_klass.
- .building_klass ⇒ Object
- .completed_klass ⇒ Object
- .post_keys ⇒ Object
- .root_klass ⇒ Object
- .sub_klasses ⇒ Object
Instance Method Summary collapse
-
#initialize(args) ⇒ ReportRendering
constructor
A new instance of ReportRendering.
- #progress ⇒ Object
Methods included from Subledger::Domain::Roles::Restable
#patch_hash, #post_hash, #serializable_hash, #to_json
Methods included from Subledger::Domain::Roles::Collectable
Methods included from Subledger::Domain::Roles::Readable
Methods included from Subledger::Domain::Roles::Creatable
Methods included from Subledger::Domain::Roles::Attributable
Methods included from Subledger::Domain
#==, #collection_name, #entity_name, included, #to_s
Constructor Details
#initialize(args) ⇒ ReportRendering
Returns a new instance of ReportRendering.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/subledger/domain/report_rendering.rb', line 50 def initialize args describable_report_rendering args identifiable args storable args @book = args[:book] @report = args[:report] @effective_at = round args[:effective_at] @rendered_at = utc_or_now args[:rendered_at] @balanced_accounts = args[:balanced_accounts] || 0 @total_accounts = args[:total_accounts] || 0 specialized_initialization args end |
Instance Attribute Details
#balanced_accounts ⇒ Object (readonly)
Returns the value of attribute balanced_accounts.
22 23 24 |
# File 'lib/subledger/domain/report_rendering.rb', line 22 def balanced_accounts @balanced_accounts end |
#book ⇒ Object (readonly)
Returns the value of attribute book.
22 23 24 |
# File 'lib/subledger/domain/report_rendering.rb', line 22 def book @book end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
22 23 24 |
# File 'lib/subledger/domain/report_rendering.rb', line 22 def effective_at @effective_at end |
#rendered_at ⇒ Object (readonly)
Returns the value of attribute rendered_at.
22 23 24 |
# File 'lib/subledger/domain/report_rendering.rb', line 22 def rendered_at @rendered_at end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
22 23 24 |
# File 'lib/subledger/domain/report_rendering.rb', line 22 def report @report end |
#total_accounts ⇒ Object (readonly)
Returns the value of attribute total_accounts.
22 23 24 |
# File 'lib/subledger/domain/report_rendering.rb', line 22 def total_accounts @total_accounts end |
Class Method Details
.active_klass ⇒ Object
TODO create uses active_klass, should use creation_klass
42 43 44 |
# File 'lib/subledger/domain/report_rendering.rb', line 42 def self.active_klass building_klass end |
.building_klass ⇒ Object
37 38 39 |
# File 'lib/subledger/domain/report_rendering.rb', line 37 def self.building_klass BuildingReportRendering end |
.completed_klass ⇒ Object
46 47 48 |
# File 'lib/subledger/domain/report_rendering.rb', line 46 def self.completed_klass CompletedReportRendering end |
.post_keys ⇒ Object
25 26 27 |
# File 'lib/subledger/domain/report_rendering.rb', line 25 def self.post_keys [ :description, :reference, :report, :effective_at ] end |
.root_klass ⇒ Object
29 30 31 |
# File 'lib/subledger/domain/report_rendering.rb', line 29 def self.root_klass ReportRendering end |
.sub_klasses ⇒ Object
33 34 35 |
# File 'lib/subledger/domain/report_rendering.rb', line 33 def self.sub_klasses [ building_klass, completed_klass ] end |
Instance Method Details
#progress ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/subledger/domain/report_rendering.rb', line 66 def progress if total_accounts.zero? 0 else ( ( balanced_accounts.to_f / total_accounts ) * 99 ).to_i end end |