module Corn::Config::ClassMethods
Public Instance Methods
config(hash={})
click to toggle source
# File lib/corn/config.rb, line 9 def config(hash={}) @config ||= {} if hash.empty? @config else @config.merge!(hash) hash.each do |key, value| if self.respond_to?(key) next end q = !!value == value ? '?' : '' self.class_eval <<-RUBY, __FILE__, __LINE__ def self.#{key}#{q}(*args) r = @config[:#{key}] r.is_a?(Proc) ? r.call(*args) : r end RUBY end @config end end