Method: Mixture::Attribute#update

Defined in:
lib/mixture/attribute.rb

#update(value) ⇒ Object

Update the attribute with the given value. It runs the value through the callbacks, and returns a new value given by the callbacks.

Parameters:

  • value (Object)

    The new value.

Returns:

  • (Object)

    The new new value.



36
37
38
# File 'lib/mixture/attribute.rb', line 36

def update(value)
  @list.callbacks[:update].inject(value) { |a, e| e.call(self, a) }
end