class ActionviewPrecompiler::ASTParser::Node

Public Class Methods

new(node) click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 12
def initialize(node)
  @node = node
end
wrap(node) click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 4
def self.wrap(node)
  if org::jruby::ast::Node === node
    new(node)
  else
    node
  end
end

Public Instance Methods

argument_nodes() click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 28
def argument_nodes
  @node.args_node.to_a[0...@node.args_node.size].map do |arg|
    self.class.wrap(arg)
  end
end
array?() click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 22
def array?;  org::jruby::ast::ArrayNode  === @node; end
children() click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 16
def children
  @children ||= @node.child_nodes.map do |child|
    self.class.wrap(child)
  end
end
fcall?() click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 23
def fcall?;  org::jruby::ast::FCallNode  === @node; end
fcall_named?(name) click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 48
def fcall_named?(name)
  fcall? &&
    @node.name == name &&
    @node.args_node &&
    org::jruby::ast::ArrayNode === @node.args_node
end
hash?() click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 24
def hash?;   org::jruby::ast::HashNode   === @node; end
inspect() click to toggle source
# File lib/actionview_precompiler/ast_parser/ruby26.rb, line 22
def inspect
  "#<#{self.class} #{@node.inspect}>"
end
string?() click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 25
def string?; org::jruby::ast::StrNode    === @node; end
symbol?() click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 26
def symbol?; org::jruby::ast::SymbolNode === @node; end
to_hash() click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 34
def to_hash
  @node.pairs.each_with_object({}) do |pair, object|
    object[self.class.wrap(pair.key)] = self.class.wrap(pair.value)
  end
end
to_string() click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 40
def to_string
  @node.value
end
to_symbol() click to toggle source
# File lib/actionview_precompiler/ast_parser/jruby.rb, line 44
def to_symbol
  @node.name
end

Private Instance Methods

type() click to toggle source
# File lib/actionview_precompiler/ast_parser/ruby26.rb, line 76
def type
  @node.type
end