Class: RRT_RUBY::RRTLogical::Role
- Inherits:
-
RRT_RUBY::RRTGeneric::Element
- Object
- RRT_RUBY::RRTGeneric::Element
- RRT_RUBY::RRTLogical::Role
- Defined in:
- lib/rrt_ruby/rrt_logical.rb
Instance Attribute Summary collapse
-
#capsule ⇒ Object
readonly
Returns the value of attribute capsule.
-
#cardinality ⇒ Object
readonly
Returns the value of attribute cardinality.
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Attributes inherited from RRT_RUBY::RRTGeneric::Element
#documentation, #name, #qualifiedname, #stereotype
Instance Method Summary collapse
-
#initialize(element) ⇒ Role
constructor
A new instance of Role.
- #to_s ⇒ Object
Constructor Details
#initialize(element) ⇒ Role
Returns a new instance of Role.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/rrt_ruby/rrt_logical.rb', line 111 def initialize element begin super(element) #name for the class and cardinality @class_name=element.ClassifierName @cardinality=element.multiplicity #get the name of the capsule containing the role @parent=element.ParentCollaboration.ParentClassifier.Name #get the capsule for the role @capsule=nil #checking against the name of the parent ensures that we avoid endless loops @capsule=Capsule.new(element.Classifier) if element.Classifier.IsClass("Capsule") && element.Classifier.name==@parent rescue raise RRTGeneric::ElementException.new(element),"error while initialising element: #{$!}" end end |
Instance Attribute Details
#capsule ⇒ Object (readonly)
Returns the value of attribute capsule.
110 111 112 |
# File 'lib/rrt_ruby/rrt_logical.rb', line 110 def capsule @capsule end |
#cardinality ⇒ Object (readonly)
Returns the value of attribute cardinality.
110 111 112 |
# File 'lib/rrt_ruby/rrt_logical.rb', line 110 def cardinality @cardinality end |
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
110 111 112 |
# File 'lib/rrt_ruby/rrt_logical.rb', line 110 def class_name @class_name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
110 111 112 |
# File 'lib/rrt_ruby/rrt_logical.rb', line 110 def parent @parent end |
Instance Method Details
#to_s ⇒ Object
128 129 130 |
# File 'lib/rrt_ruby/rrt_logical.rb', line 128 def to_s return "#{@name}/#{@class_name}" end |