lib/configurations/configurable.rb in configurations-1.0.1 vs lib/configurations/configurable.rb in configurations-1.1.0

- old
+ new

@@ -18,12 +18,14 @@ def install_configure_in(base) base.class_eval <<-EOF class << self # The central configure method # @params [Proc] block the block to configure host module with + # @raise [ArgumentError] error when not given a block # def configure(&block) + raise ArgumentError, 'can not configure without a block' unless block_given? @configuration = #{self}::Configuration.new(@configuration_defaults, @configurable, &block) end end EOF end @@ -31,10 +33,12 @@ # Class methods that will get installed in the host module # module ClassMethods # A reader for Configuration # - attr_reader :configuration + def configuration + @configuration ||= @configuration_defaults && configure { } + end # Configuration defaults can be used to set the defaults of any Configuration # @param [Proc] block setting the default values of the configuration # def configuration_defaults(&block)