class Markdoc::Sequence::Role
Attributes
border[RW]
column[RW]
fill[RW]
font[RW]
height[RW]
id[RW]
label[RW]
line[RW]
messages[RW]
offsetx[RW]
offsety[RW]
prev[RW]
radius[RW]
spacing[RW]
succ[RW]
width[RW]
Public Class Methods
new(args)
click to toggle source
# File lib/markdoc/sequence.rb, line 44 def initialize(args) self.messages = [] self.id = args[:id].strip self.label = args[:label].strip # ui settings self.column = args[:column] self.offsetx = args[:diagram][:offsetx] self.offsety = args[:diagram][:offsety] self.border = args[:ui][:border] self.fill = args[:ui][:fill] self.radius = args[:ui][:radius] self.spacing = args[:ui][:spacing] self.width = args[:ui][:width] self.height = args[:ui][:height] self.line = args[:ui][:line] self.font = args[:ui][:font] end
Public Instance Methods
<=>(o)
click to toggle source
# File lib/markdoc/sequence.rb, line 63 def <=> o column <=> o.column end
center()
click to toggle source
# File lib/markdoc/sequence.rb, line 82 def center x + width/2 end
print()
click to toggle source
# File lib/markdoc/sequence.rb, line 94 def print elements = [] case type when :actor elements << %Q[<g transform="translate(#{x+10},0)"><path d="M74,64 a30,30 0 0,0 -27,-27 a16,18 0 1,0 -16,0 a30,30 0, 0,0 -27,27 z" stroke-width="#{line}" fill="#{fill}" stroke="#{border}"/></g>] elements << %Q[<text x="#{x+46-2*id.size}" y="#{y+height-5}" font-family="#{font}" font-size="12" fill="#{border}">#{id}</text>] else elements << %Q[<rect fill="#{fill}" stroke="#{border}" rx="#{radius}" ry="#{radius}" x="#{x}" y="#{y}" width="#{width}" height="#{height}" stroke-width="#{line}"/>] elements << %Q[<text x="#{x+10}" y="#{y+20}" font-family="#{font}" font-size="12" fill="#{border}">#{label}</text>] end x1 = center y1 = offsety + height x2 = center y2 = messages.last.y + 10 elements << %Q[<line x1="#{x1}" y1="#{y1}" x2="#{x2}" y2="#{y2}" stroke="#{border}" stroke-width="#{line}"/>] elements.join("\n") end
type()
click to toggle source
# File lib/markdoc/sequence.rb, line 67 def type case label when /actor/i :actor when /database/i :database when /site|web/i :website when /application|system/i :system else :component end end
x()
click to toggle source
# File lib/markdoc/sequence.rb, line 86 def x offsetx + column*(width + spacing) end
y()
click to toggle source
# File lib/markdoc/sequence.rb, line 90 def y offsety end