Class: Fastererer::RescueCall

Inherits:
Object
  • Object
show all
Defined in:
lib/fastererer/rescue_call.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ RescueCall

Returns a new instance of RescueCall.



9
10
11
# File 'lib/fastererer/rescue_call.rb', line 9

def initialize(node)
  @element = node
end

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



7
8
9
# File 'lib/fastererer/rescue_call.rb', line 7

def element
  @element
end

Instance Method Details

#rescue_classesObject

Only unqualified constants: a namespaced ‘Foo::NoMethodError` is not the core NoMethodError, so it must not match the rescue_vs_respond_to check.



15
16
17
18
19
# File 'lib/fastererer/rescue_call.rb', line 15

def rescue_classes
  @rescue_classes ||= element.exceptions.filter_map do |exception|
    exception.name if exception.is_a?(Prism::ConstantReadNode)
  end
end