Package org.jruby.ast
Class HashNode
java.lang.Object
org.jruby.ast.Node
org.jruby.ast.HashNode
- All Implemented Interfaces:
ILiteralNode
A Literal Hash that can represent either a {a=&b, c=&d} type expression or the list
of default values or kwarg in a method call.
-
Field Summary
Fields inherited from class org.jruby.ast.Node
containsVariableAssignment, newline
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
accept
(NodeVisitor<T> iVisitor) Accept for the visitor pattern.add
(KeyValuePair<Node, Node> pair) Node[]
getKeys()
getPairs()
boolean
Detect whether only rest kwargs make up this hash.boolean
boolean
Detect presence of a rest kwarg (**kw).boolean
isEmpty()
boolean
boolean
Deprecated.boolean
removeAll
(Collection<KeyValuePair<Node, Node>> pairsToRemove) void
Not all interesting info in the AST is from Node data.Methods inherited from class org.jruby.ast.Node
containsVariableAssignment, createList, createList, createList, createList, executesOnce, getFile, getLine, getNodeName, isNewline, isNil, needsDefinitionCheck, setLine, setNewline, toString, toString, toStringInternal, unsetNewline
-
Constructor Details
-
HashNode
public HashNode(int line) -
HashNode
-
-
Method Details
-
setIsLiteral
public void setIsLiteral() -
isLiteral
public boolean isLiteral() -
hasRestKwarg
public boolean hasRestKwarg()Detect presence of a rest kwarg (**kw).- Returns:
- true if it contains at least one rest kwarg.
-
hasOnlyRestKwargs
public boolean hasOnlyRestKwargs()Detect whether only rest kwargs make up this hash. Common case is **a which is HashNode{[(null, a)]}. Less common is **a, **b which is HashNode{[(null, a), (null, b)].}- Returns:
- true is only rest kwargs
-
getNodeType
- Specified by:
getNodeType
in classNode
- Returns:
- the nodeId
-
add
-
removeAll
-
accept
Accept for the visitor pattern. -
isEmpty
public boolean isEmpty() -
getPairs
-
childNodes
- Specified by:
childNodes
in classNode
-
toStringExtraInfo
Description copied from class:Node
Not all interesting info in the AST is from Node data. This method will print out anything else of note (e.g. FixnumNode's long value).- Overrides:
toStringExtraInfo
in classNode
- Returns:
- null for no extra info or something otherwise.
-
hasOnlySymbolKeys
public boolean hasOnlySymbolKeys() -
isMaybeKwargs
Deprecated. -
getKeys
-