class OmfEc::Parameter

This class describes a Parameter

Attributes

defaultValue[R]
description[R]
id[R]
name[R]

Public Class Methods

new(id, name, description, defaultValue = nil) click to toggle source

Create a new Parameter instance

  • id = parameter identifier

  • name = name for this parameter

  • description = short description of this parameter

  • defaultValue = optional, a defautl value for this parameter (default=nil)

# File lib/omf_ec/parameter.rb, line 22
def initialize(id, name, description, defaultValue = nil)
  @id = id
  @name = name != nil ? name : id
  @description = description
  @defaultValue = defaultValue
end

Public Instance Methods

to_xml() click to toggle source

Return the definition of this Parameter as an XML element

Return

an XML element with the definition of this Parameter

# File lib/omf_ec/parameter.rb, line 34
def to_xml
  a = REXML::Element.new("parameter")
  a.add_attribute("id", id)
  a.add_attribute("name", name)
  if (description != nil)
    a.add_element("description").text = description
  end
  if (defaultValue != nil)
    a.add_element("default").text = defaultValue
  end
  return a
end