Class: Aruba::InConfigWrapper
- Inherits:
-
Object
- Object
- Aruba::InConfigWrapper
- 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
-
#initialize(config) ⇒ InConfigWrapper
constructor
A new instance of InConfigWrapper.
- #method_missing(name, *args) ⇒ Object
- #respond_to_missing?(name, _include_private) ⇒ Boolean
Constructor Details
#initialize(config) ⇒ InConfigWrapper
Returns a new instance of InConfigWrapper.
15 16 17 |
# File 'lib/aruba/in_config_wrapper.rb', line 15 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
19 20 21 22 23 24 25 26 27 |
# File 'lib/aruba/in_config_wrapper.rb', line 19 def method_missing(name, *args) if config.key? name raise ArgumentError, 'Options take no argument' if args.any? config[name] else super end end |
Instance Method Details
#respond_to_missing?(name, _include_private) ⇒ Boolean
29 30 31 |
# File 'lib/aruba/in_config_wrapper.rb', line 29 def respond_to_missing?(name, _include_private) config.key? name end |