class SyntaxTree::RescueEx
RescueEx
represents the list of exceptions being rescued in a rescue clause.
begin rescue Exception => exception end
Attributes
exceptions[R]
- nil |
Node
-
the list of exceptions being rescued
Public Class Methods
new(exceptions:, variable:, location:)
click to toggle source
# File lib/syntax_tree/node.rb, line 9344 def initialize(exceptions:, variable:, location:) @exceptions = exceptions @variable = variable @location = location @comments = [] end
Public Instance Methods
===(other)
click to toggle source
# File lib/syntax_tree/node.rb, line 9396 def ===(other) other.is_a?(RescueEx) && exceptions === other.exceptions && variable === other.variable end
accept(visitor)
click to toggle source
# File lib/syntax_tree/node.rb, line 9351 def accept(visitor) visitor.visit_rescue_ex(self) end
child_nodes()
click to toggle source
# File lib/syntax_tree/node.rb, line 9355 def child_nodes [*exceptions, variable] end
Also aliased as: deconstruct
copy(exceptions: nil, variable: nil, location: nil)
click to toggle source
# File lib/syntax_tree/node.rb, line 9359 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
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/node.rb, line 9373 def deconstruct_keys(_keys) { exceptions: exceptions, variable: variable, location: location, comments: comments } end
format(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 9382 def format(q) q.group do if exceptions q.text(" ") q.format(exceptions) end if variable q.text(" => ") q.format(variable) end end end