Method: Vedeu::Repositories::Defaults#initialize

Defined in:
lib/vedeu/repositories/defaults.rb

#initialize(attributes = {}) ⇒ void

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.

Note:

If a particular key is missing from the attributes parameter, then it is added with the respective value from #defaults.

Returns a new instance of the class including this module.

Parameters:

  • attributes (Hash) (defaults to: {})


23
24
25
26
27
# File 'lib/vedeu/repositories/defaults.rb', line 23

def initialize(attributes = {})
  defaults.merge!(attributes).each do |key, value|
    instance_variable_set("@#{key}", value || defaults.fetch(key))
  end
end