module Dao::Entity::Dirty
Public Instance Methods
_dump(_level)
click to toggle source
# File lib/dao/entity/dirty.rb, line 20 def _dump(_level) prepare_for_dump do Marshal.dump(self) end end
_load(marshal_string)
click to toggle source
# File lib/dao/entity/dirty.rb, line 27 def _load(marshal_string) Marshal.load(marshal_string).tap(&:initialize_entity_state) end
after_initialize()
click to toggle source
Calls superclass method
# File lib/dao/entity/dirty.rb, line 6 def after_initialize super initialize_entity_state end
entity_state()
click to toggle source
# File lib/dao/entity/dirty.rb, line 16 def entity_state @entity_state.tap { |s| s.assign_attributes(attributes) } end
initialize_entity_state()
click to toggle source
# File lib/dao/entity/dirty.rb, line 11 def initialize_entity_state @in_dump_mode = false @entity_state = self.class.state_class.new(attributes) end
respond_to?(*args)
click to toggle source
Calls superclass method
# File lib/dao/entity/dirty.rb, line 36 def respond_to?(*args) if args.first == :_dump not @in_dump_mode else super end end
state_class()
click to toggle source
# File lib/dao/entity/dirty.rb, line 31 def state_class @_state_class ||= State.build_with_attrs(attribute_set.collect(&:name)) end
Protected Instance Methods
prepare_for_dump() { || ... }
click to toggle source
# File lib/dao/entity/dirty.rb, line 46 def prepare_for_dump current_entity_state = @entity_state @entity_state = nil @in_dump_mode = true result = yield @entity_state = current_entity_state @in_dump_mode = false result end