Module: Virtus::InstanceMethods::Constructor

Defined in:
lib/virtus/instance_methods.rb

Instance Method Summary collapse

Instance Method Details

#initialize(attributes = nil) ⇒ undefined

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.

Set attributes during initialization of an object

Parameters:

  • attributes (#to_hash) (defaults to: nil)

    the attributes hash to be set

Returns:

  • (undefined)


16
17
18
19
# File 'lib/virtus/instance_methods.rb', line 16

def initialize(attributes = nil)
  attribute_set.set(self, attributes) if attributes
  set_default_attributes
end