Module: Anima::Update

Defined in:
lib/anima/update.rb

Overview

Module for mixin in update functionallity to anima infected clases

Instance Method Summary collapse

Instance Method Details

#update(attributes) ⇒ Anima

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return updated instance

Examples:

klass = Class.new do
  include Anima.new(:foo, :bar), Anima::Update
end

foo = klass.new(:foo => 1, :bar => 2)
updated = foo.update(:foo => 3)
updated.foo # => 3
updated.bar # => 2

Parameters:

  • attributes (Hash)

Returns:



25
26
27
# File 'lib/anima/update.rb', line 25

def update(attributes)
  self.class.new(to_h.update(attributes))
end