Sha256: e97d60110856e8026190a4c1822f8a40bb09751354b4833527a1da6df1390cad

Contents?: true

Size: 952 Bytes

Versions: 2

Compression:

Stored size: 952 Bytes

Contents

require 'parameters/param'

module Parameters
  class ClassParam < Param

    # Default value of the class parameter
    attr_accessor :value

    #
    # Creates a new ClassParam object.
    #
    # @param [Symbol, String] name
    #   The name of the class parameter.
    #
    # @param [String, nil] description
    #   The description of the class parameter.
    #
    # @param [Object, nil] value
    #   The default value of the class parameter.
    #
    def initialize(name,description=nil,value=nil)
      super(name,description)

      @value = value
    end

    #
    # @return [String]
    #   The representation of the class param.
    #
    def to_s
      text = @name.to_s

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

      return text
    end

    #
    # @return [String]
    #   Inspection of the class params value.
    #
    def inspect
      @value.inspect
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parameters-0.1.9 lib/parameters/class_param.rb
parameters-0.1.8 lib/parameters/class_param.rb