class EvilEvents::Shared::AnyConfig

@api public @since 0.4.0

Public Class Methods

configure(&configuration) click to toggle source

@param configuration [Proc] @return [Proc]

@api public @since 0.4.0

# File lib/evil_events/shared/any_config.rb, line 12
def configure(&configuration)
  case
  when !block_given? && !instance_variable_defined?(:@setup)
    @setup = proc {}
  when block_given?
    @setup = configuration
  else
    @setup
  end
end
new() { |conf| ... } click to toggle source

@api public @since 0.4.0

# File lib/evil_events/shared/any_config.rb, line 26
def initialize
  setup = self.class.configure

  @config = Module.new do
    extend Dry::Configurable
    instance_eval(&setup)
  end

  @config.configure { |conf| yield(conf) if block_given? }
end

Public Instance Methods

method_missing(method_name, *attributes, &block) click to toggle source

@api private @since 0.4.0

Calls superclass method
# File lib/evil_events/shared/any_config.rb, line 48
def method_missing(method_name, *attributes, &block)
  return super unless @config.respond_to?(method_name)
  @config.public_send(method_name, *attributes, &block)
end
respond_to_missing?(method_name, include_private = false) click to toggle source

:nocov: @api private @since 0.4.0

Calls superclass method
# File lib/evil_events/shared/any_config.rb, line 56
def respond_to_missing?(method_name, include_private = false)
  @config.respond_to?(method_name, include_private) || super
end
to_h() click to toggle source

@return [Hash]

@api public @since 0.4.0

# File lib/evil_events/shared/any_config.rb, line 41
def to_h
  @config.config.to_h
end
Also aliased as: to_hash
to_hash()
Alias for: to_h