Class: Markdoc::Sequence::Message
- Inherits:
-
Object
- Object
- Markdoc::Sequence::Message
- Defined in:
- lib/markdoc/sequence.rb
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#dest ⇒ Object
Returns the value of attribute dest.
-
#label ⇒ Object
Returns the value of attribute label.
-
#source ⇒ Object
Returns the value of attribute source.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #deliver ⇒ Object
- #describe ⇒ Object
- #height ⇒ Object
-
#initialize(type, source, dest, label, comment) ⇒ Message
constructor
A new instance of Message.
- #roles ⇒ Object
Constructor Details
#initialize(type, source, dest, label, comment) ⇒ Message
Returns a new instance of Message.
48 49 50 |
# File 'lib/markdoc/sequence.rb', line 48 def initialize(type, source, dest, label, comment) self.type, self.source, self.dest, self.label, self.comment = type, source, dest, label.strip, comment.strip end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
47 48 49 |
# File 'lib/markdoc/sequence.rb', line 47 def comment @comment end |
#dest ⇒ Object
Returns the value of attribute dest.
47 48 49 |
# File 'lib/markdoc/sequence.rb', line 47 def dest @dest end |
#label ⇒ Object
Returns the value of attribute label.
47 48 49 |
# File 'lib/markdoc/sequence.rb', line 47 def label @label end |
#source ⇒ Object
Returns the value of attribute source.
47 48 49 |
# File 'lib/markdoc/sequence.rb', line 47 def source @source end |
#type ⇒ Object
Returns the value of attribute type.
47 48 49 |
# File 'lib/markdoc/sequence.rb', line 47 def type @type end |
Instance Method Details
#deliver ⇒ Object
56 57 58 |
# File 'lib/markdoc/sequence.rb', line 56 def deliver %Q[#{type}(#{source.id},#{dest.id}, "#{label}");] end |
#describe ⇒ Object
60 61 62 63 64 65 |
# File 'lib/markdoc/sequence.rb', line 60 def describe return if comment.empty? width = comment.length > 10 ? 1 : comment.length * 0.13 width = 0.5 if width < 0.5 %Q[comment(#{dest.id},C,up 0.2 right, wid #{'%.1f' % width} ht 0.3 "#{comment}");] end |
#height ⇒ Object
67 68 69 |
# File 'lib/markdoc/sequence.rb', line 67 def height source == dest ? 2 : 1 end |
#roles ⇒ Object
52 53 54 |
# File 'lib/markdoc/sequence.rb', line 52 def roles [source, dest] end |