Method: Synvert::Core::NodeQuery::Compiler::String#actual_value

Defined in:
lib/synvert/core/node_query/compiler/string.rb

#actual_value(node) ⇒ String

Get the actual value of a node.

Parameters:

Returns:

  • (String)

    if node is a Parser::AST::Node, return the node source code, otherwise, return the string value.



22
23
24
25
26
27
28
# File 'lib/synvert/core/node_query/compiler/string.rb', line 22

def actual_value(node)
  if node.is_a?(::Parser::AST::Node)
    node.to_source
  else
    node.to_s
  end
end