Module: ActiveInteractor::Configurable::ClassMethods Private

Defined in:
lib/active_interactor/configurable.rb

Overview

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

Configurable object class methods. Because ClassMethods is a module classes should extend ClassMethods rather than inherit from it.

Author:

Since:

  • 1.0.0

Instance Method Summary collapse

Instance Method Details

#defaults(options = {}) ⇒ Hash{Symbol=>*}

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.

Get or Set the default attributes for a ActiveInteractor::Configurable class. This method will create an attr_accessor on the configurable class as well as set a default value for the attribute.

Parameters:

Returns:

  • (Hash{Symbol=>*})

    the passed options or the set defaults if no options are passed.

Since:

  • 1.0.0



29
30
31
32
33
34
35
36
# File 'lib/active_interactor/configurable.rb', line 29

def defaults(options = {})
  return __defaults if options.empty?

  options.each do |key, value|
    __defaults[key.to_sym] = value
    send(:attr_accessor, key.to_sym)
  end
end