Sha256: 33ea20df74b499c1431f3b60b72bb167172b3f9b760b7b4ad0345375a082b403
Contents?: true
Size: 486 Bytes
Versions: 2
Compression:
Stored size: 486 Bytes
Contents
class Hadley::Config def initialize(config={}) @config = config end def method_missing(name, *args, &block) if block_given? proc(name, &block) elsif name =~ /(.+)=$/ set($1, *args, &block) else get(name, &block) end end def proc(name, &block) @config[name.to_sym] = block end def set(name, *args) @config[name.to_sym] = args.size == 1 ? args.first : args end def get(name, &block) @config[name.to_sym] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hadley-0.0.2 | lib/hadley/config.rb |
hadley-0.0.1 | lib/hadley/config.rb |