Sha256: 4f61813f9361dfc047b63cf94f5d6bf18ffcc6165594a05a1382de013d2a0fbd
Contents?: true
Size: 804 Bytes
Versions: 4
Compression:
Stored size: 804 Bytes
Contents
module Confuse # A {ConfigItem} is a class for storing a single piece of config. It has a # key, a type, a description, and a default value. class ConfigItem attr_reader :key attr_writer :value attr_reader :default_value def initialize(name, &block) @key = name instance_eval(&block) unless block.nil? end def description(description = nil) @description = description unless description.nil? @description end def type(type = nil) @type = type unless type.nil? @type end def default(value = nil, &block) @default_value = value unless value.nil? @default_value = block unless block.nil? end def value=(val) @value = val end def value @value || @default_value end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
confuse-0.1.8 | lib/confuse/config_item.rb |
confuse-0.1.7 | lib/confuse/config_item.rb |
confuse-0.1.6 | lib/confuse/config_item.rb |
confuse-0.1.5 | lib/confuse/config_item.rb |