Class: Parameter
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#stereotypes ⇒ Object
readonly
Returns the value of attribute stereotypes.
-
#tagged_values ⇒ Object
readonly
Returns the value of attribute tagged_values.
Attributes inherited from Tag
Instance Method Summary collapse
- #full_name ⇒ Object
-
#initialize(xml, parent_tag) ⇒ Parameter
constructor
A new instance of Parameter.
- #stereotype_by_name(name) ⇒ Object
- #tagged_value_by_name(tagged_value_name) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Tag
Constructor Details
#initialize(xml, parent_tag) ⇒ Parameter
Returns a new instance of Parameter.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/xmimodel/parameter.rb', line 13 def initialize(xml, parent_tag) super(xml, parent_tag) @id = xml.attribute("xmi:id").to_s @name = xml.attribute("name").to_s @kind = xml.attribute("kind").to_s @stereotypes = Array.new XmiHelper.stereotypes(xml).each do |uml_stereotype| stereotype = Stereotype.new(uml_stereotype, self) @stereotypes << stereotype end @tagged_values = Array.new XmiHelper.tagged_values(xml).each do |uml_tagged_value| tagged_value = TaggedValue.new(uml_tagged_value, self) @tagged_values << tagged_value end end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
8 9 10 |
# File 'lib/xmimodel/parameter.rb', line 8 def kind @kind end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/xmimodel/parameter.rb', line 7 def name @name end |
#stereotypes ⇒ Object (readonly)
Returns the value of attribute stereotypes.
10 11 12 |
# File 'lib/xmimodel/parameter.rb', line 10 def stereotypes @stereotypes end |
#tagged_values ⇒ Object (readonly)
Returns the value of attribute tagged_values.
11 12 13 |
# File 'lib/xmimodel/parameter.rb', line 11 def tagged_values @tagged_values end |
Instance Method Details
#full_name ⇒ Object
45 46 47 48 |
# File 'lib/xmimodel/parameter.rb', line 45 def full_name return "#{@parent_tag.full_name}::#{@kind}" if (@name.nil? || @name.empty?) return "#{@parent_tag.full_name}::#{@name}" end |
#stereotype_by_name(name) ⇒ Object
39 40 41 42 43 |
# File 'lib/xmimodel/parameter.rb', line 39 def stereotype_by_name(name) stereotype = @stereotypes.select{|obj| obj.name == name} return stereotype[0] if !stereotype.nil? && stereotype.size > 0 nil end |
#tagged_value_by_name(tagged_value_name) ⇒ Object
33 34 35 36 37 |
# File 'lib/xmimodel/parameter.rb', line 33 def tagged_value_by_name(tagged_value_name) tagged_value = @tagged_values.select{|obj| obj.name == tagged_value_name} return tagged_value[0] if !tagged_value.nil? && tagged_value.size > 0 nil end |
#to_s ⇒ Object
50 51 52 |
# File 'lib/xmimodel/parameter.rb', line 50 def to_s "Parameter[#{full_name}]" end |