Class: Aruba::InConfigWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/aruba/in_config_wrapper.rb

Overview

In config wrapper

Used to make the configuration read only if one needs to access an configuration option from with `Aruba::Config`.

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ InConfigWrapper

Returns a new instance of InConfigWrapper.


13
14
15
# File 'lib/aruba/in_config_wrapper.rb', line 13

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object


17
18
19
20
21
22
# File 'lib/aruba/in_config_wrapper.rb', line 17

def method_missing(name, *args)
  fail ArgumentError, 'Options take no argument' if args.count > 0
  fail UnknownOptionError, %(Option "#{name}" is unknown. Please use only earlier defined options) unless config.key? name

  config[name]
end