Class: SequenceDiagram::Participant
- Inherits:
-
Object
- Object
- SequenceDiagram::Participant
- Defined in:
- lib/yard-sd/sequence_diagram/participant.rb
Constant Summary collapse
- @@uid =
0
Instance Attribute Summary collapse
-
#aliasing ⇒ Object
readonly
Returns the value of attribute aliasing.
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, aliasing, distance = nil, thread = false) ⇒ Participant
constructor
A new instance of Participant.
- #to_s ⇒ Object
Constructor Details
#initialize(name, aliasing, distance = nil, thread = false) ⇒ Participant
Returns a new instance of Participant.
9 10 11 12 13 14 15 |
# File 'lib/yard-sd/sequence_diagram/participant.rb', line 9 def initialize(name, aliasing, distance = nil, thread = false) @name = name @aliasing = aliasing @distance = distance @thread = thread @uid = @@uid += 1 end |
Instance Attribute Details
#aliasing ⇒ Object (readonly)
Returns the value of attribute aliasing.
8 9 10 |
# File 'lib/yard-sd/sequence_diagram/participant.rb', line 8 def aliasing @aliasing end |
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
6 7 8 |
# File 'lib/yard-sd/sequence_diagram/participant.rb', line 6 def distance @distance end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/yard-sd/sequence_diagram/participant.rb', line 5 def name @name end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
7 8 9 |
# File 'lib/yard-sd/sequence_diagram/participant.rb', line 7 def uid @uid end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 |
# File 'lib/yard-sd/sequence_diagram/participant.rb', line 26 def ==(other) @uid == other.uid end |
#to_s ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/yard-sd/sequence_diagram/participant.rb', line 17 def to_s cmd = @thread ? "newthread" : "newinst" if @distance.nil? "\\#{cmd}{#@uid}{#{SequenceDiagram.latex_escape(@name)}}" else "\\#{cmd}[#@distance]{#@uid}{#{SequenceDiagram.latex_escape(@name)}}" end end |