lib/distil/configurable.rb in distil-0.11.8 vs lib/distil/configurable.rb in distil-0.12.0

- old
+ new

@@ -25,11 +25,11 @@ def get_options(settings=nil, parent=nil) keys= @@options.keys values= @@options.map { |k,v| convert_type(v[:type], v[:value]) } - s= Struct.new(*keys).new(*values) + s= @options ? @options : (@options=Struct.new(*keys).new(*values)) return s if !settings setting_keys= settings.keys.map { |key| key.to_s } @@options.each { |key, value| @@ -59,10 +59,11 @@ s[key]= setting_value } + @extras.merge!(settings) s end # option name, [type], [default], [options] def self.option(name, *rest) @@ -123,14 +124,14 @@ # self.send :protected, "#{name}=".to_s end def initialize(options={}, parent=nil) + @extras= Hash.new if (parent.is_a?(Configurable)) parent_options= parent.options end - @options= get_options(options, parent_options) - @extras= options + get_options(options, parent_options) end private def convert_type(type, value)