Module: Sandthorn::AggregateRoot::Marshal
- Included in:
- Sandthorn::AggregateRoot
- Defined in:
- lib/sandthorn/aggregate_root_marshal.rb
Instance Method Summary collapse
- #aggregate_initialize(*args) ⇒ Object
- #get_delta ⇒ Object
- #set_instance_variables!(attribute) ⇒ Object
Instance Method Details
#aggregate_initialize(*args) ⇒ Object
5 6 7 8 |
# File 'lib/sandthorn/aggregate_root_marshal.rb', line 5 def aggregate_initialize *args @aggregate_attribute_deltas = {} @aggregate_stored_instance_variables = {} end |
#get_delta ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/sandthorn/aggregate_root_marshal.rb', line 20 def get_delta deltas = extract_relevant_aggregate_instance_variables deltas.each { |d| delta_attribute(d) } result = @aggregate_attribute_deltas clear_aggregate_deltas result end |
#set_instance_variables!(attribute) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/sandthorn/aggregate_root_marshal.rb', line 10 def set_instance_variables! attribute super attribute init_vars = extract_relevant_aggregate_instance_variables init_vars.each do |attribute_name| @aggregate_stored_instance_variables[attribute_name] = ::Marshal.dump(instance_variable_get(attribute_name)) end end |