Sha256: 9620e39bde0b15e0db893948e099a64feb2ad7be42a3f3144de21bcd54c04c9d
Contents?: true
Size: 750 Bytes
Versions: 1
Compression:
Stored size: 750 Bytes
Contents
module Configr class ConfigurationBlock attr_accessor :attributes def initialize(attributes={}) self.attributes = Hash.new(attributes) end def method_missing(method, *args, &block) name = method.to_s case when name.include?('=') key = name.gsub('=','').to_sym self.attributes[key] = args.first when existing_block_attributes = self.attributes[method] existing_block = ConfigurationBlock.new(existing_block_attributes) self.attributes[method] = existing_block.attributes existing_block else nested_block = ConfigurationBlock.new self.attributes[method] = nested_block.attributes nested_block end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
configr-0.2.0 | lib/configr/configuration_block.rb |