Sha256: 35b5291a4114cce3c27d7379a299be78face9a2ea1386cc2134189c3eb7f1c59
Contents?: true
Size: 521 Bytes
Versions: 9
Compression:
Stored size: 521 Bytes
Contents
class Settings def configure(configuration=nil, &block) instance_eval(&configuration) if configuration instance_eval(&block) if block end def method_missing(method, value=nil, &block) set(method, value, block) if !value.nil? or block get(method) end private def set(name, value, block) instance_variable_set "@#{name}", !value.nil? ? value : block end def get(name) value = instance_variable_get "@#{name}" value = value.call if value.respond_to? :call value end end
Version data entries
9 entries across 9 versions & 1 rubygems