class Aruba::ConfigWrapper
@private
users.
This class is not meant for direct use - ConfigWrapper.new - by normal
If an option is changed, it notifies the event queue.
This wraps the current runtime configuration of aruba.
def ==(other)
Somehow `#respond_to_missing?`, `method_missing?` and `respond_to?` don't
The comparism is done based on their values. No hooks are compared.
Compare two configs
def ==(other) config == other end
def initialize(config, event_bus)
-
event_bus
(#notify
) -- -
config
(Config
) --
def initialize(config, event_bus) @config = config @event_bus = event_bus end
def method_missing(name, *args, &block)
If one method ends with "=", e.g. ":option1=", then notify the event
Proxy all methods
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
def notify(name, args)
def notify(name, args) event_bus.notify( Events::ChangedConfiguration.new( changed: { name: name.to_s.gsub(/=$/, ""), value: args.first } ) ) end
def respond_to?(m)
def respond_to?(m) config.respond_to? m end
def respond_to_missing?(name, _include_private)
def respond_to_missing?(name, _include_private) config.respond_to? name end