Class: Parameters::ClassParam

Inherits:
Param show all
Defined in:
lib/parameters/class_param.rb

Instance Attribute Summary

Instance Method Summary

Constructor Details

- (ClassParam) initialize(name, description = nil, value = nil)

Creates a new ClassParam object.

Parameters:

  • (Symbol, String) name — The name of the class parameter.
  • (String, nil) description (defaults to: nil) — The description of the class parameter.
  • (Object, nil) value (defaults to: nil) — The default value of the class parameter.


21
22
23
24
25
# File 'lib/parameters/class_param.rb', line 21

def initialize(name,description=nil,value=nil)
  super(name,description)

  @value = value
end

Instance Attribute Details

- (Object) value

Default value of the class parameter



7
8
9
# File 'lib/parameters/class_param.rb', line 7

def value
  @value
end

Instance Method Details

- (String) inspect

Inspection of the class params value.

Returns:

  • (String) — Inspection of the class params value.


44
45
46
# File 'lib/parameters/class_param.rb', line 44

def inspect
  @value.inspect
end

- (String) to_s

The representation of the class param.

Returns:

  • (String) — The representation of the class param.


31
32
33
34
35
36
37
38
# File 'lib/parameters/class_param.rb', line 31

def to_s
  text = @name.to_s

  text << " [#{@value.inspect}]" if @value
  text << "\t#{@description}" if @description

  return text
end