Sha256: 92c1afa72634bef55c67d48e2fc8697e3ae04a392a84d773e012e22fc4a817e9

Contents?: true

Size: 637 Bytes

Versions: 2

Compression:

Stored size: 637 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)
      fail ArgumentError, 'Options take no argument' if args.any?
      fail UnknownOptionError, %(Option "#{name}" is unknown. Please use only earlier defined options) unless config.key? name

      config[name]
    end

    def respond_to_missing?(*)
      true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aruba-1.0.0 lib/aruba/in_config_wrapper.rb
aruba-1.0.0.pre.alpha.5 lib/aruba/in_config_wrapper.rb