Class: Generalization

Inherits:
Tag
  • Object
show all
Defined in:
lib/xmimodel/generalization.rb

Overview

UML:Generalization

Instance Attribute Summary collapse

Attributes inherited from Tag

#id, #parent_tag, #xml

Instance Method Summary collapse

Methods inherited from Tag

#xml_root

Constructor Details

#initialize(xml, parent_tag) ⇒ Generalization

Returns a new instance of Generalization.


12
13
14
15
16
17
# File 'lib/xmimodel/generalization.rb', line 12

def initialize(xml, parent_tag)
	super(xml, parent_tag)

	@child = XmiHelper.generalization_child(xml)
	@parent = XmiHelper.generalization_parent(xml)
end

Instance Attribute Details

#childObject (readonly)

Returns the value of attribute child


9
10
11
# File 'lib/xmimodel/generalization.rb', line 9

def child
  @child
end

#parentObject (readonly)

Returns the value of attribute parent


10
11
12
# File 'lib/xmimodel/generalization.rb', line 10

def parent
  @parent
end

Instance Method Details

#child_objObject


19
20
21
22
# File 'lib/xmimodel/generalization.rb', line 19

def child_obj
	return nil if @child.nil? or @child.empty?
	@child_obj = xml_root.class_by_id(@child)
end

#parent_objObject


24
25
26
27
# File 'lib/xmimodel/generalization.rb', line 24

def parent_obj
	return nil if @parent.nil? or @parent.empty?
	@parent_obj = xml_root.class_by_id(@parent)
end

#to_sObject


29
30
31
# File 'lib/xmimodel/generalization.rb', line 29

def to_s
	"Generalization[#{@parent_obj} <- #{@child_obj}]"
end