Class: Markdoc::Pseudocode::IfLiteral
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Markdoc::Pseudocode::IfLiteral
- Defined in:
- lib/markdoc/pseudocode.rb
Instance Method Summary collapse
Instance Method Details
#ends ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# 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 ⇒ Object
43 44 45 |
# File 'lib/markdoc/pseudocode.rb', line 43 def id cond.id end |
#out(file) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# 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 |