class SyntaxTree::RescueEx
RescueEx
represents the list of exceptions being rescued in a rescue clause.
begin rescue Exception => exception end
Attributes
- nil |
Node
-
the list of exceptions being rescued
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 9359 def initialize(exceptions:, variable:, location:) @exceptions = exceptions @variable = variable @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 9411 def ===(other) other.is_a?(RescueEx) && exceptions === other.exceptions && variable === other.variable end
Source
# File lib/syntax_tree/node.rb, line 9366 def accept(visitor) visitor.visit_rescue_ex(self) end
Source
# File lib/syntax_tree/node.rb, line 9370 def child_nodes [*exceptions, variable] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 9374 def copy(exceptions: nil, variable: nil, location: nil) node = RescueEx.new( exceptions: exceptions || self.exceptions, variable: variable || self.variable, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
Source
# File lib/syntax_tree/node.rb, line 9388 def deconstruct_keys(_keys) { exceptions: exceptions, variable: variable, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 9397 def format(q) q.group do if exceptions q.text(" ") q.format(exceptions) end if variable q.text(" => ") q.format(variable) end end end