lib/parameters/class_methods.rb in parameters-0.1.9 vs lib/parameters/class_methods.rb in parameters-0.2.0

- old
+ new

@@ -41,26 +41,34 @@ # The name of the new parameter. # # @param [Hash] options # Additional options. # - # @option options [String] :description - # The description for the new parameter. + # @option options [Class, Array[Class]] :type + # The type to enforce the parameter values to. # # @option options [Object, Proc] :default # The default value for the new parameter. # + # @option options [String] :description + # The description for the new parameter. + # # @example # parameter 'var' # # @example # parameter 'var', :default => 3, :description => 'my variable' # def parameter(name,options={}) name = name.to_sym # add the parameter to the class params list - params[name] = Parameters::ClassParam.new(name,options[:description],options[:default]) + params[name] = Parameters::ClassParam.new( + name, + options[:type], + options[:description], + options[:default] + ) # define the reader class method for the parameter meta_def(name) do params[name].value end