class SyntaxTree::AssocSplat
AssocSplat
represents double-splatting a value into a hash (either a hash literal or a bare hash in a method call).
{ **pairs }
Attributes
value[R]
- nil |
Node
-
the expression that is being splatted
Public Class Methods
new(value:, location:)
click to toggle source
# File lib/syntax_tree/node.rb, line 1582 def initialize(value:, location:) @value = value @location = location @comments = [] end
Public Instance Methods
===(other)
click to toggle source
# File lib/syntax_tree/node.rb, line 1618 def ===(other) other.is_a?(AssocSplat) && value === other.value end
accept(visitor)
click to toggle source
# File lib/syntax_tree/node.rb, line 1588 def accept(visitor) visitor.visit_assoc_splat(self) end
child_nodes()
click to toggle source
# File lib/syntax_tree/node.rb, line 1592 def child_nodes [value] end
Also aliased as: deconstruct
copy(value: nil, location: nil)
click to toggle source
# File lib/syntax_tree/node.rb, line 1596 def copy(value: nil, location: nil) node = AssocSplat.new( value: value || self.value, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/node.rb, line 1609 def deconstruct_keys(_keys) { value: value, location: location, comments: comments } end
format(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 1613 def format(q) q.text("**") q.format(value) if value end