class JsDuck::Js::NodeArray
Wraps around array of AST nodes.
Public Class Methods
new(nodes)
click to toggle source
Initialized with array of AST Hashes from Esprima.
# File lib/jsduck/js/node_array.rb, line 9 def initialize(nodes) @nodes = nodes || [] end
Public Instance Methods
[](i)
click to toggle source
Returns
a child AST node as AstNode class.
# File lib/jsduck/js/node_array.rb, line 14 def [](i) Js::Node.create(@nodes[i]) end
each() { |create| ... }
click to toggle source
Iterates over all the AstNodes in array.
# File lib/jsduck/js/node_array.rb, line 24 def each @nodes.each {|p| yield(Js::Node.create(p)) } end
length()
click to toggle source
The length of array
# File lib/jsduck/js/node_array.rb, line 19 def length @nodes.length end
map() { |create| ... }
click to toggle source
Maps over all the AstNodes in array.
# File lib/jsduck/js/node_array.rb, line 29 def map @nodes.map {|p| yield(Js::Node.create(p)) } end