class Markdoc::Pseudocode::IfLiteral

Public Instance Methods

ends() click to toggle source
# File lib/markdoc/pseudocode.rb, line 46
def ends
  ary = []
  if yes.elements.empty?
    ary << yes.id
  else
    ary << yes.elements.last.ends
  end
  if no.elements.empty?
    ary << no.id
  else
    ary << no.elements.last.ends
  end
  ary.flatten
end
id() click to toggle source
# File lib/markdoc/pseudocode.rb, line 43
def id
  cond.id
end
out(file) click to toggle source
# File lib/markdoc/pseudocode.rb, line 30
def out(file)
  file.write %Q(#{id} [shape=diamond label="#{cond.value}"]\n)

  unless yes.nil?
    yes.out(file)
    file.write %Q(  #{id} -> #{yes.id} [label="Yes"]\n)
  end
  unless no.nil?
    no.out(file)
    file.write %Q(  #{id} -> #{no.id} [label="No"]\n)
  end
end