Class: Generalization
- Inherits:
-
Object
- Object
- Generalization
- Defined in:
- lib/xmimodel/generalization.rb
Overview
UML:Generalization
Instance Attribute Summary collapse
-
#child ⇒ Object
readonly
Returns the value of attribute child.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
- #child_obj ⇒ Object
-
#initialize(xml, xmi_model) ⇒ Generalization
constructor
A new instance of Generalization.
- #parent_obj ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(xml, xmi_model) ⇒ Generalization
Returns a new instance of Generalization.
13 14 15 16 17 18 19 20 |
# File 'lib/xmimodel/generalization.rb', line 13 def initialize(xml, xmi_model) @xml = xml @xmi_model = xmi_model @id = xml.attribute("xmi.id").to_s @child = XmiHelper.generalization_child(xml) @parent = XmiHelper.generalization_parent(xml) end |
Instance Attribute Details
#child ⇒ Object (readonly)
Returns the value of attribute child.
10 11 12 |
# File 'lib/xmimodel/generalization.rb', line 10 def child @child end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/xmimodel/generalization.rb', line 9 def id @id end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
11 12 13 |
# File 'lib/xmimodel/generalization.rb', line 11 def parent @parent end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
7 8 9 |
# File 'lib/xmimodel/generalization.rb', line 7 def xml @xml end |
Instance Method Details
#child_obj ⇒ Object
22 23 24 25 |
# File 'lib/xmimodel/generalization.rb', line 22 def child_obj return nil if @child.nil? or @child.empty? @child_obj = @xmi_model.class_by_id(@child) end |
#parent_obj ⇒ Object
27 28 29 30 |
# File 'lib/xmimodel/generalization.rb', line 27 def parent_obj return nil if @parent.nil? or @parent.empty? @parent_obj = @xmi_model.class_by_id(@parent) end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/xmimodel/generalization.rb', line 32 def to_s "Generalization[#{@parent_obj} <- #{@child_obj}]" end |