Sha256: 603d111797d47920cbdf87d1661ea08df63efb71c15cae7b3952a1ebf2aa7403

Contents?: true

Size: 522 Bytes

Versions: 34

Compression:

Stored size: 522 Bytes

Contents

require 'fasterer/rescue_call'
require 'fasterer/offense'
require 'fasterer/scanners/offensive'

module Fasterer
  class RescueCallScanner
    include Fasterer::Offensive

    attr_reader :element

    def initialize(element)
      @element = element
      check_offense
    end

    private

    def check_offense
      if rescue_call.rescue_classes.include? :NoMethodError
        add_offense(:rescue_vs_respond_to)
      end
    end

    def rescue_call
      @rescue_call ||= RescueCall.new(element)
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
fasterer-0.11.0 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.10.1 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.10.0 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.9.0 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.8.3 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.8.2 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.8.1 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.8.0 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.7.1 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.7.0 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.6.0 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.5.1 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.5.0 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.4.2 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.4.1 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.4.0 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.3.2 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.3.1 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.3.0 lib/fasterer/scanners/rescue_call_scanner.rb
fasterer-0.2.1 lib/fasterer/scanners/rescue_call_scanner.rb