A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://ruby-syntax-tree.github.io/syntax_tree/SyntaxTree/RescueMod.html below:

class SyntaxTree::RescueMod - RDoc Documentation

  1. SyntaxTree::
  2. RescueMod
class SyntaxTree::RescueMod

RescueMod represents the use of the modifier form of a rescue clause.

expression rescue value
Attributes
Node

the expression to execute

Node

the value to use if the executed expression raises an error

Public Class Methods

Source

def initialize(statement:, value:, location:)
  @statement = statement
  @value = value
  @location = location
  @comments = []
end
Public Instance Methods

Source

def ===(other)
  other.is_a?(RescueMod) && statement === other.statement &&
    value === other.value
end

Source

def accept(visitor)
  visitor.visit_rescue_mod(self)
end

Source

def child_nodes
  [statement, value]
end

Source

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

def deconstruct_keys(_keys)
  {
    statement: statement,
    value: value,
    location: location,
    comments: comments
  }
end

Source

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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4