class Encryption::Configuration::Base

Public Class Methods

new() click to toggle source
# File lib/configuration/base.rb, line 5
def initialize
  @config = { }
end

Public Instance Methods

config() { |self| ... } click to toggle source
# File lib/configuration/base.rb, line 9
def config
  yield self
end
method_missing(name, *args) click to toggle source
Calls superclass method
# File lib/configuration/base.rb, line 13
def method_missing(name, *args)
    
  return @config[name.to_sym] if is_valid_getter(name)
  return @config[name[0..-2].to_sym] = args[0] if is_valid_setter(name)

  super
end
respond_to?(name) click to toggle source
Calls superclass method
# File lib/configuration/base.rb, line 21
def respond_to?(name)
  return true if is_valid_getter(name) or is_valid_setter(name)
  super
end

Private Instance Methods

is_valid_getter(name) click to toggle source
# File lib/configuration/base.rb, line 28
def is_valid_getter(name)
  @config.has_key? name.to_sym
end
is_valid_setter(name) click to toggle source
# File lib/configuration/base.rb, line 32
def is_valid_setter(name)
  name = name.to_s
  name[-1, 1] == '=' and @config.has_key? name[0..-2].to_sym
end