Class: OmfEc::Parameter
- Inherits:
-
Object
- Object
- OmfEc::Parameter
- Defined in:
- omf_ec/lib/omf_ec/parameter.rb
Overview
This class describes a Parameter
Instance Attribute Summary (collapse)
-
- (Object) defaultValue
readonly
Returns the value of attribute defaultValue.
-
- (Object) description
readonly
Returns the value of attribute description.
-
- (Object) id
readonly
Returns the value of attribute id.
-
- (Object) name
readonly
Returns the value of attribute name.
Instance Method Summary (collapse)
-
- (Parameter) initialize(id, name, description, defaultValue = nil)
constructor
Create a new Parameter instance.
-
- (Object) to_xml
Return the definition of this Parameter as an XML element.
Constructor Details
- (Parameter) initialize(id, name, description, defaultValue = nil)
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)
22 23 24 25 26 27 |
# File 'omf_ec/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 |
Instance Attribute Details
- (Object) defaultValue (readonly)
Returns the value of attribute defaultValue
12 13 14 |
# File 'omf_ec/lib/omf_ec/parameter.rb', line 12 def defaultValue @defaultValue end |
- (Object) description (readonly)
Returns the value of attribute description
12 13 14 |
# File 'omf_ec/lib/omf_ec/parameter.rb', line 12 def description @description end |
- (Object) id (readonly)
Returns the value of attribute id
12 13 14 |
# File 'omf_ec/lib/omf_ec/parameter.rb', line 12 def id @id end |
- (Object) name (readonly)
Returns the value of attribute name
12 13 14 |
# File 'omf_ec/lib/omf_ec/parameter.rb', line 12 def name @name end |
Instance Method Details
- (Object) to_xml
Return the definition of this Parameter as an XML element
- Return
-
an XML element with the definition of this Parameter
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'omf_ec/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 |