Class: Parameters::ClassParam
- Defined in:
- lib/parameters/class_param.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
Default value of the class parameter.
Attributes inherited from Param
Instance Method Summary collapse
-
#initialize(name, type = nil, description = nil, value = nil) ⇒ ClassParam
constructor
Creates a new ClassParam object.
-
#inspect ⇒ String
Inspects the class parameter.
-
#to_instance(object) ⇒ InstanceParam
Creates an instance parameter from the class param.
-
#to_s ⇒ String
The representation of the class param.
Methods inherited from Param
Constructor Details
#initialize(name, type = nil, description = nil, value = nil) ⇒ ClassParam
Creates a new ClassParam object.
24 25 26 27 28 |
# File 'lib/parameters/class_param.rb', line 24 def initialize(name,type=nil,description=nil,value=nil) super(name,type,description) @value = value end |
Instance Attribute Details
#value ⇒ Object
Default value of the class parameter
7 8 9 |
# File 'lib/parameters/class_param.rb', line 7 def value @value end |
Instance Method Details
#inspect ⇒ String
Inspects the class parameter.
87 88 89 |
# File 'lib/parameters/class_param.rb', line 87 def inspect "#<#{self.class}: #{@value.inspect}>" end |
#to_instance(object) ⇒ InstanceParam
Creates an instance parameter from the class param.
58 59 60 61 62 63 64 65 66 |
# File 'lib/parameters/class_param.rb', line 58 def to_instance(object) InstanceParam.new( object, @name, @type, @description, @value ) end |
#to_s ⇒ String
Returns The representation of the class param.
72 73 74 75 76 77 78 79 |
# File 'lib/parameters/class_param.rb', line 72 def to_s text = @name.to_s text << "\t[#{@value.inspect}]" if @value text << "\t#{@description}" if @description return text end |