Module: Dao::Entity::Dirty

Extended by:
ActiveSupport::Concern
Defined in:
lib/dao/entity/dirty.rb

Instance Method Summary collapse

Instance Method Details

#_dump(_level) ⇒ Object



20
21
22
23
24
# File 'lib/dao/entity/dirty.rb', line 20

def _dump(_level)
  prepare_for_dump do
    Marshal.dump(self)
  end
end

#after_initializeObject



6
7
8
9
# File 'lib/dao/entity/dirty.rb', line 6

def after_initialize
  super
  initialize_entity_state
end

#entity_stateObject



16
17
18
# File 'lib/dao/entity/dirty.rb', line 16

def entity_state
  @entity_state.tap { |s| s.assign_attributes(attributes) }
end

#initialize_entity_stateObject



11
12
13
14
# 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) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
39
40
41
42
# File 'lib/dao/entity/dirty.rb', line 36

def respond_to?(*args)
  if args.first == :_dump
    not @in_dump_mode
  else
    super
  end
end