class SyntaxTree::BlockArg
BlockArg
represents declaring a block parameter on a method definition.
def method(&block); end
Attributes
name[R]
- nil |
Ident
-
the name of the block argument
Public Class Methods
new(name:, location:)
click to toggle source
# File lib/syntax_tree/node.rb, line 2234 def initialize(name:, location:) @name = name @location = location @comments = [] end
Public Instance Methods
===(other)
click to toggle source
# File lib/syntax_tree/node.rb, line 2270 def ===(other) other.is_a?(BlockArg) && name === other.name end
accept(visitor)
click to toggle source
# File lib/syntax_tree/node.rb, line 2240 def accept(visitor) visitor.visit_blockarg(self) end
child_nodes()
click to toggle source
# File lib/syntax_tree/node.rb, line 2244 def child_nodes [name] end
Also aliased as: deconstruct
copy(name: nil, location: nil)
click to toggle source
# File lib/syntax_tree/node.rb, line 2248 def copy(name: nil, location: nil) node = BlockArg.new( name: name || self.name, 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 2261 def deconstruct_keys(_keys) { name: name, location: location, comments: comments } end
format(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 2265 def format(q) q.text("&") q.format(name) if name end