class Aruba::ConfigWrapper
This wraps the current runtime configuration of aruba. If an option is changed, it notifies the event queue.
This class is not meant for direct use - ConfigWrapper.new
- by normal users.
@private
Attributes
config[R]
event_bus[R]
Public Class Methods
new(config, event_bus)
click to toggle source
Create proxy
@param [Config] config
An aruba config object.
@param [#notify] event_bus
The event queue which should be notified.
# File lib/aruba/config_wrapper.rb, line 23 def initialize(config, event_bus) @config = config @event_bus = event_bus end
Public Instance Methods
==(other)
click to toggle source
Compare two configs
The comparism is done based on their values. No hooks are compared.
Somehow ‘#respond_to_missing?`, `method_missing?` and `respond_to?` don’t help here.
# File lib/aruba/config_wrapper.rb, line 51 def ==(other) config == other end
method_missing(name, *args, &block)
click to toggle source
Proxy all methods
If one method ends with “=”, e.g. “:option1=”, then notify the event queue, that the user changes the value of “option1”
Calls superclass method
# File lib/aruba/config_wrapper.rb, line 32 def method_missing(name, *args, &block) notify(name, args) if name.to_s.end_with?("=") return config.send(name, *args, &block) if config.respond_to? name super end
respond_to?(m)
click to toggle source
Pass on respond_to?-calls
# File lib/aruba/config_wrapper.rb, line 56 def respond_to?(m) config.respond_to? m end
respond_to_missing?(name, _include_private)
click to toggle source
Pass on respond_to?-calls
# File lib/aruba/config_wrapper.rb, line 41 def respond_to_missing?(name, _include_private) config.respond_to? name end
Private Instance Methods
notify(name, args)
click to toggle source
# File lib/aruba/config_wrapper.rb, line 62 def notify(name, args) event_bus.notify( Events::ChangedConfiguration.new( changed: { name: name.to_s.gsub(/=$/, ""), value: args.first } ) ) end