lib/parameters/instance_param.rb in parameters-0.1.0 vs lib/parameters/instance_param.rb in parameters-0.1.1
- old
+ new
@@ -6,11 +6,11 @@
#
# Creates a new InstanceParam object with the specified _object_ and
# _name_, and the given _description_.
#
- def initialize(object,name,description='')
+ def initialize(object,name,description=nil)
super(name,description)
@object = object
end
@@ -24,9 +24,21 @@
#
# Sets the value of the instance param.
#
def value=(value)
@object.instance_variable_set("@#{@name}",value)
+ end
+
+ #
+ # Returns a String representation of the instance param.
+ #
+ def to_s
+ text = " #{@name}"
+
+ text << " [#{value}]" if value
+ text << "\t#{@description}" if @description
+
+ return text
end
#
# Inspects the instance params value.
#