Class: StyleScript::ParentheticalNode

Inherits:
Node
  • Object
show all
Defined in:
lib/style_script/nodes.rb

Overview

An extra set of parentheses, supplied by the script source. You can’t wrap parentheses around bits that get compiled into JS statements, unfortunately.

Constant Summary

Constants inherited from Node

Node::TAB

Instance Method Summary collapse

Methods inherited from Node

#children, children, #compile, #compile_closure, #contains?, #idt, statement, #statement?, statement_only, #statement_only?, top_sensitive, #top_sensitive?, #unwrap, #write

Constructor Details

#initialize(expressions, line = nil) ⇒ ParentheticalNode

Returns a new instance of ParentheticalNode.



974
975
976
977
# File 'lib/style_script/nodes.rb', line 974

def initialize(expressions, line=nil)
  @expressions = expressions.unwrap
  @line = line
end

Instance Method Details

#compile_node(o) ⇒ Object



979
980
981
982
983
# File 'lib/style_script/nodes.rb', line 979

def compile_node(o)
  compiled = @expressions.compile(o)
  compiled = compiled[0...-1] if compiled[-1..-1] == ';'
  write("(#{compiled})")
end