class Loggun::OrderedOptions

Public Instance Methods

[](key) click to toggle source
Calls superclass method
# File lib/loggun/ordered_options.rb, line 15
def [](key)
  super(key.to_sym)
end
Also aliased as: _get
[]=(key, value) click to toggle source
Calls superclass method
# File lib/loggun/ordered_options.rb, line 6
def []=(key, value)
  if self[key.to_sym].is_a?(Loggun::OrderedOptions) &&
     [true, false].include?(value)
    return self[key.to_sym][:enable] = value
  end

  super(key.to_sym, value)
end
_get(key)
Alias for: []
method_missing(name, *args) click to toggle source
# File lib/loggun/ordered_options.rb, line 19
def method_missing(name, *args)
  name_string = +name.to_s
  if name_string.chomp!('=')
    self[name_string] = args.first
  else
    bangs = name_string.chomp!('!')

    if bangs
      self[name_string].presence || raise(KeyError, ":#{name_string} is blank")
    else
      self[name_string]
    end
  end
end
respond_to_missing?(_name, _include_private) click to toggle source
# File lib/loggun/ordered_options.rb, line 34
def respond_to_missing?(_name, _include_private)
  true
end