Module: Dry::Effects::Initializer::InstanceMethods Private

Defined in:
lib/dry/effects/initializer.rb

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.

Instance Method Summary collapse

Instance Method Details

#freezeObject

This makes sure we memoize options before an object becomes frozen



99
100
101
102
# File 'lib/dry/effects/initializer.rb', line 99

def freeze
  options
  super
end

#optionsHash

Instance options

Returns:

  • (Hash)


85
86
87
88
89
90
91
# File 'lib/dry/effects/initializer.rb', line 85

def options
  # rubocop:disable Layout/LineLength
  @__options__ ||= self.class.dry_initializer.definitions.values.each_with_object({}) do |item, obj|
    obj[item.target] = instance_variable_get(item.ivar)
  end
  # rubocop:enable Layout/LineLength
end