Class: TaggedValue
- Inherits:
-
Object
- Object
- TaggedValue
- Defined in:
- lib/xmimodel/tagged_value.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
- #==(obj) ⇒ Object
-
#initialize(xml, owner) ⇒ TaggedValue
constructor
A new instance of TaggedValue.
- #to_s ⇒ Object
Constructor Details
#initialize(xml, owner) ⇒ TaggedValue
Returns a new instance of TaggedValue.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/xmimodel/tagged_value.rb', line 10 def initialize(xml, owner) @xml = xml @owner = owner @id = xml.attribute("xmi.id").to_s @name = xml.attribute("name").to_s if @name.nil? or @name.empty? tag_definition = XmiHelper.taggeg_value_tag_definition(xml) tag_definition_id_ref = tag_definition.attribute("xmi.idref").to_s tag_definition = XmiHelper.tag_definition_by_id(xml, tag_definition_id_ref) @name = tag_definition.attribute("name").to_s end @value = XmiHelper.taggeg_value_data_value(xml) @value = XmiHelper.taggeg_value_reference_value(xml) if (@value.nil? || @value.empty?) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/xmimodel/tagged_value.rb', line 6 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/xmimodel/tagged_value.rb', line 7 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/xmimodel/tagged_value.rb', line 8 def value @value end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
4 5 6 |
# File 'lib/xmimodel/tagged_value.rb', line 4 def xml @xml end |
Instance Method Details
#==(obj) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/xmimodel/tagged_value.rb', line 29 def ==(obj) return false if obj.nil? if String == obj.class return "#{@name}=#{@value}".eql?(obj) else return @name.eql?(obj.name) && @value.eql?(obj.value) end end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/xmimodel/tagged_value.rb', line 38 def to_s "TaggedValue[#{@name}=#{@value}]" end |