class SyntaxTree::RescueMod
RescueMod
represents the use of the modifier form of a rescue
clause.
expression rescue value
Attributes
statement[R]
Node
-
the expression to execute
value[R]
Node
-
the value to use if the executed expression raises an error
Public Class Methods
new(statement:, value:, location:)
click to toggle source
# File lib/syntax_tree/node.rb, line 9541 def initialize(statement:, value:, location:) @statement = statement @value = value @location = location @comments = [] end
Public Instance Methods
===(other)
click to toggle source
# File lib/syntax_tree/node.rb, line 9597 def ===(other) other.is_a?(RescueMod) && statement === other.statement && value === other.value end
accept(visitor)
click to toggle source
# File lib/syntax_tree/node.rb, line 9548 def accept(visitor) visitor.visit_rescue_mod(self) end
child_nodes()
click to toggle source
# File lib/syntax_tree/node.rb, line 9552 def child_nodes [statement, value] end
Also aliased as: deconstruct
copy(statement: nil, value: nil, location: nil)
click to toggle source
# File lib/syntax_tree/node.rb, line 9556 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
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/node.rb, line 9570 def deconstruct_keys(_keys) { statement: statement, value: value, location: location, comments: comments } end
format(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 9579 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