require 'mixlib/cli'

class SimpleConfig
  include Mixlib::CLI

  def method_missing(meth, *args, &blk)
    return config[meth] if config.has_key?(meth)
    super
  end

  def respond_to?(meth, include_private = false)
    super || config.has_key?(meth)
  end
end

require 'mixlib/cli'

class SimpleConfig
  include Mixlib::CLI

  def method_missing(meth, *args, &blk)
    if config.has_key?(meth)
      self.class.send(:define_method, meth) do
        config[meth]
      end
      config[meth]
    else
      super
    end
  end

  def respond_to?(meth, include_private = false)
    super || config.has_key?(meth)
  end
end

Define methods for valid config values
Define methods for valid config values

Rather than relying on method_missing always, which
is slower than we want, define a method if the configuration
has data for that method name / key. This way we immediately
return data from the hash instead of going through the
method_missing process every time.