Module: Subledger::Domain::Roles::Restable
- Included in:
- Account, Balance, Book, Category, Control, Identity, JournalEntry, Key, Line, Org, Subledger::Domain::Report, Subledger::Domain::ReportRendering
- Defined in:
- lib/subledger/domain/roles/restable.rb
Instance Method Summary collapse
Instance Method Details
#patch_hash ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/subledger/domain/roles/restable.rb', line 17 def patch_hash hash = { } self.class.patch_keys.each do |key| value = self.send key hash[key] = translate( key, value ) unless exclude? value end hash end |
#post_hash ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/subledger/domain/roles/restable.rb', line 5 def post_hash hash = { } self.class.post_keys.each do |key| value = self.send key hash[key] = translate( key, value ) unless exclude? value end hash end |
#serializable_hash ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/subledger/domain/roles/restable.rb', line 29 def serializable_hash entity = self.class::Entity.new self hash = entity.serializable_hash hash.each do |key, value| hash.delete( key ) if exclude? value end hash end |
#to_json ⇒ Object
41 42 43 |
# File 'lib/subledger/domain/roles/restable.rb', line 41 def to_json MultiJson.dump serializable_hash end |