Sha256: b8e110d6e0110ed3aac62638b64cb3e42e0e7779c4fee0eec28edd75ce9d58ea

Contents?: true

Size: 609 Bytes

Versions: 10

Compression:

Stored size: 609 Bytes

Contents

# Aruba
module Aruba
  # In config wrapper
  #
  # Used to make the configuration read only if one needs to access an
  # configuration option from with `Aruba::Config`.
  #
  # @private
  class InConfigWrapper
    attr_reader :config
    private :config

    def initialize(config)
      @config = config.dup
    end

    def method_missing(name, *args)
      if config.key? name
        raise ArgumentError, "Options take no argument" if args.any?

        config[name]
      else
        super
      end
    end

    def respond_to_missing?(name, _include_private)
      config.key? name
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/aruba-2.2.0/lib/aruba/in_config_wrapper.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/aruba-2.2.0/lib/aruba/in_config_wrapper.rb
aruba-2.2.0 lib/aruba/in_config_wrapper.rb
aruba-2.1.0 lib/aruba/in_config_wrapper.rb
aruba-2.0.1 lib/aruba/in_config_wrapper.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/aruba-2.0.0/lib/aruba/in_config_wrapper.rb
aruba-2.0.0 lib/aruba/in_config_wrapper.rb
aruba-1.1.2 lib/aruba/in_config_wrapper.rb
aruba-1.1.1 lib/aruba/in_config_wrapper.rb
aruba-1.1.0 lib/aruba/in_config_wrapper.rb