Sha256: 272ca455a8823fbcf94a7c19f195b0b2fbb70cc50cccb1c5a1ae984630519f4d

Contents?: true

Size: 673 Bytes

Versions: 38

Compression:

Stored size: 673 Bytes

Contents

# frozen_string_literal: true

require_relative 'method_context'

module Reek
  module Context
    #
    # A context wrapper for any singleton method definition found in a syntax tree.
    #
    class SingletonMethodContext < MethodContext
      def singleton_method?
        true
      end

      def instance_method?
        false
      end

      def module_function?
        false
      end

      # Was this singleton method defined with an instance method-like syntax?
      def defined_as_instance_method?
        type == :def
      end

      def apply_current_visibility(current_visibility)
        super if defined_as_instance_method?
      end
    end
  end
end

Version data entries

38 entries across 36 versions & 2 rubygems

Version Path
reek-6.3.0 lib/reek/context/singleton_method_context.rb
reek-6.2.0 lib/reek/context/singleton_method_context.rb
reek-6.1.4 lib/reek/context/singleton_method_context.rb
reek-6.1.3 lib/reek/context/singleton_method_context.rb
reek-6.1.2 lib/reek/context/singleton_method_context.rb
reek-6.1.1 lib/reek/context/singleton_method_context.rb
reek-6.1.0 lib/reek/context/singleton_method_context.rb
reek-6.0.6 lib/reek/context/singleton_method_context.rb
reek-6.0.5 lib/reek/context/singleton_method_context.rb
reek-6.0.4 lib/reek/context/singleton_method_context.rb
reek-6.0.3 lib/reek/context/singleton_method_context.rb
reek-6.0.2 lib/reek/context/singleton_method_context.rb
reek-6.0.1 lib/reek/context/singleton_method_context.rb
reek-6.0.0 lib/reek/context/singleton_method_context.rb
reek-5.6.0 lib/reek/context/singleton_method_context.rb
reek-5.5.0 lib/reek/context/singleton_method_context.rb
reek-5.4.1 lib/reek/context/singleton_method_context.rb
reek-5.4.0 lib/reek/context/singleton_method_context.rb
reek-5.3.2 lib/reek/context/singleton_method_context.rb
reek-5.3.1 lib/reek/context/singleton_method_context.rb