Sha256: 56edeca1dcb1a98e332c81eea0be9c2af91efbaa3fc1afe0a3defa81d7ef5973
Contents?: true
Size: 773 Bytes
Versions: 1
Compression:
Stored size: 773 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 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
confuse-0.1.4 | lib/confuse/config_item.rb |