Class: StyleScript::AccessorNode

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

Overview

A dotted accessor into a part of a value, or the

shorthand for

an accessor into the object’s prototype.

Constant Summary

Constants inherited from Node

Node::TAB

Instance Attribute Summary collapse

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(name, tag = nil) ⇒ AccessorNode

Returns a new instance of AccessorNode.



407
408
409
410
411
# File 'lib/style_script/nodes.rb', line 407

def initialize(name, tag=nil)
  @name       = name
  @prototype  = tag == :prototype
  @soak       = tag == :soak
end

Instance Attribute Details

#soakObject (readonly)

Returns the value of attribute soak.



405
406
407
# File 'lib/style_script/nodes.rb', line 405

def soak
  @soak
end

Instance Method Details

#compile_node(o) ⇒ Object



413
414
415
416
# File 'lib/style_script/nodes.rb', line 413

def compile_node(o)
  proto = @prototype ? "prototype." : ''
  write(".#{proto}#{@name}")
end