lib/parameters/class_param.rb in parameters-0.2.3 vs lib/parameters/class_param.rb in parameters-0.3.0
- old
+ new
@@ -41,9 +41,32 @@
def value=(new_value)
@value = coerce(new_value)
end
#
+ # Creates an instance parameter from the class param.
+ #
+ # @param [Object] object
+ # The object the instance parameter should be connected to.
+ #
+ # @return [InstanceParam]
+ # The new instance parameter.
+ #
+ # @since 0.3.0
+ #
+ # @api semipublic
+ #
+ def to_instance(object)
+ InstanceParam.new(
+ object,
+ @name,
+ @type,
+ @description,
+ @value
+ )
+ end
+
+ #
# @return [String]
# The representation of the class param.
#
def to_s
text = @name.to_s