Top Description Fields Constructors Methods
org.jruby.ast

public Class HashNode

extends Node
implements ILiteralNode
Class Inheritance
All Implemented Interfaces
org.jruby.ast.types.ILiteralNode
Imports
java.util.ArrayList, .Collection, .List, org.jruby.ast.types.ILiteralNode, org.jruby.ast.visitor.NodeVisitor, org.jruby.util.KeyValuePair

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

Modifier and TypeField and Description
private boolean
private boolean
private boolean
private final List<KeyValuePair<Node, Node>>
Inherited from org.jruby.ast.Node:
containsVariableAssignmentEMPTY_LISTnewline

Constructor Summary

AccessConstructor and Description
public
HashNode(int line)

public
HashNode(int line, KeyValuePair<Node, Node> pair)

Method Summary

Modifier and TypeMethod and Description
public <T> T
accept(NodeVisitor<T>
the visitor
iVisitor
)

Implements abstract org.jruby.ast.Node.accept.

Accept for the visitor pattern.

public HashNode
public List<Node>
public Node[]
public NodeType
public List<KeyValuePair<Node, Node>>
public boolean

Returns:

true is only rest kwargs
hasOnlyRestKwargs
()

Detect whether only rest kwargs make up this hash.

public boolean
public boolean

Returns:

true if it contains at least one rest kwarg.
hasRestKwarg
()

Detect presence of a rest kwarg (**kw).

public boolean
public boolean
public boolean
isMaybeKwargs()
Deprecated

public boolean
removeAll(final Collection<KeyValuePair<Node, Node>> pairsToRemove)

public void
public String
toStringExtraInfo()

Overrides org.jruby.ast.Node.toStringExtraInfo.

Not all interesting info in the AST is from Node data.

Inherited from org.jruby.ast.Node:
containsVariableAssignmentcreateListcreateListcreateListcreateListexecutesOncegetFilegetLinegetNodeNameisNewlineisNilneedsDefinitionChecksetLinesetNewlinetoStringtoStringtoStringInternalunsetNewline

Field Detail

hasOnlySymbolKeysback to summary
private boolean hasOnlySymbolKeys
hasRestKwargback to summary
private boolean hasRestKwarg
isLiteralback to summary
private boolean isLiteral
pairsback to summary
private final List<KeyValuePair<Node, Node>> pairs

Constructor Detail

HashNodeback to summary
public HashNode(int line)
HashNodeback to summary
public HashNode(int line, KeyValuePair<Node, Node> pair)

Method Detail

acceptback to summary
public <T> T accept(NodeVisitor<T> iVisitor)

Implements abstract org.jruby.ast.Node.accept.

Accept for the visitor pattern.

Parameters
iVisitor:NodeVisitor<T>

the visitor

addback to summary
public HashNode add(KeyValuePair<Node, Node> pair)
childNodesback to summary
public List<Node> childNodes()

Implements abstract org.jruby.ast.Node.childNodes.

getKeysback to summary
public Node[] getKeys()
getNodeTypeback to summary
public NodeType getNodeType()

Implements abstract org.jruby.ast.Node.getNodeType.

Returns:NodeType

Doc from org.jruby.ast.Node.getNodeType.

the nodeId

getPairsback to summary
public List<KeyValuePair<Node, Node>> getPairs()
hasOnlyRestKwargsback to summary
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:boolean

true is only rest kwargs

hasOnlySymbolKeysback to summary
public boolean hasOnlySymbolKeys()
hasRestKwargback to summary
public boolean hasRestKwarg()

Detect presence of a rest kwarg (**kw).

Returns:boolean

true if it contains at least one rest kwarg.

isEmptyback to summary
public boolean isEmpty()
isLiteralback to summary
public boolean isLiteral()
isMaybeKwargsback to summary
public boolean isMaybeKwargs()

Deprecated

Annotations
@Deprecated
removeAllback to summary
public boolean removeAll(final Collection<KeyValuePair<Node, Node>> pairsToRemove)
setIsLiteralback to summary
public void setIsLiteral()
toStringExtraInfoback to summary
public String toStringExtraInfo()

Overrides org.jruby.ast.Node.toStringExtraInfo.

Doc from org.jruby.ast.Node.toStringExtraInfo.

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).

Returns:String

null for no extra info or something otherwise.

Annotations
@Override