class SyntaxTree::Begin
Begin
represents a begin..end chain.
begin value end
Attributes
BodyStmt
-
the bodystmt that contains the contents of this begin block
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 1921 def initialize(bodystmt:, location:) @bodystmt = bodystmt @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 1966 def ===(other) other.is_a?(Begin) && bodystmt === other.bodystmt end
Source
# File lib/syntax_tree/node.rb, line 1927 def accept(visitor) visitor.visit_begin(self) end
Source
# File lib/syntax_tree/node.rb, line 1931 def child_nodes [bodystmt] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 1935 def copy(bodystmt: nil, location: nil) node = Begin.new( bodystmt: bodystmt || self.bodystmt, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
Source
# File lib/syntax_tree/node.rb, line 1948 def deconstruct_keys(_keys) { bodystmt: bodystmt, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 1952 def format(q) q.text("begin") unless bodystmt.empty? q.indent do q.breakable_force unless bodystmt.statements.empty? q.format(bodystmt) end end q.breakable_force q.text("end") end