Class: ORB::AST::PrintingExpressionNode

Inherits:
AbstractNode show all
Defined in:
lib/orb/ast/printing_expression_node.rb

Overview

A node representing a printing expression

Constant Summary collapse

BLOCK_RE =
/\A(if|unless)\b|\bdo\s*(\|[^|]*\|)?\s*$/

Instance Attribute Summary collapse

Attributes inherited from AbstractNode

#attributes, #children, #errors

Instance Method Summary collapse

Methods inherited from AbstractNode

#==, #add_child

Constructor Details

#initialize(token) ⇒ PrintingExpressionNode



11
12
13
14
# File 'lib/orb/ast/printing_expression_node.rb', line 11

def initialize(token)
  super
  @expression = token.value
end

Instance Attribute Details

#expressionObject (readonly)

Returns the value of attribute expression.



9
10
11
# File 'lib/orb/ast/printing_expression_node.rb', line 9

def expression
  @expression
end

Instance Method Details

#block?Boolean



16
17
18
# File 'lib/orb/ast/printing_expression_node.rb', line 16

def block?
  @expression =~ BLOCK_RE
end

#end?Boolean



20
21
22
# File 'lib/orb/ast/printing_expression_node.rb', line 20

def end?
  @expression.strip == 'end'
end

#render(_context) ⇒ Object



24
25
26
# File 'lib/orb/ast/printing_expression_node.rb', line 24

def render(_context)
  "NOT IMPLEMENTED"
end