class SyntaxTree::RescueMod
RescueMod
represents the use of the modifier form of a rescue
clause.
expression rescue value
Attributes
Node
-
the expression to execute
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 9556 def initialize(statement:, value:, location:) @statement = statement @value = value @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 9612 def ===(other) other.is_a?(RescueMod) && statement === other.statement && value === other.value end
Source
# File lib/syntax_tree/node.rb, line 9563 def accept(visitor) visitor.visit_rescue_mod(self) end
Source
# File lib/syntax_tree/node.rb, line 9567 def child_nodes [statement, value] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 9571 def copy(statement: nil, value: nil, location: nil) node = RescueMod.new( statement: statement || self.statement, value: value || self.value, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
Source
# File lib/syntax_tree/node.rb, line 9585 def deconstruct_keys(_keys) { statement: statement, value: value, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 9594 def format(q) q.text("begin") q.group do q.indent do q.breakable_force q.format(statement) end q.breakable_force q.text("rescue StandardError") q.indent do q.breakable_force q.format(value) end q.breakable_force end q.text("end") end