class Ccp::Utils::Options::Proxy

Attributes

keys[R]

Public Class Methods

new(base, *keys) click to toggle source
# File lib/ccp/utils/options.rb, line 19
        def initialize(base, *keys)
          @base = base
          @keys = keys.map(&:to_sym)

          @keys.each do |key|
            @base.dsl_accessor key
#            instance_eval "def self.#{key}; :#{key}; end"
          end
        end

Public Instance Methods

[](key) click to toggle source
# File lib/ccp/utils/options.rb, line 29
def [](key)
  @base.__send__(key)
end
each() { |self| ... } click to toggle source
# File lib/ccp/utils/options.rb, line 33
def each(&block)
  keys.each do |key|
    yield(self[key])
  end
end
options() click to toggle source
# File lib/ccp/utils/options.rb, line 39
def options
  opts = {}
  keys.each do |key|
    val = self[key]
    opts[key] = val unless val.nil?
  end
  return opts
end