Sha256: b39bad3bd53fb09e969e7e324bb3969cd52149b24ce5568479e94899547587ea

Contents?: true

Size: 642 Bytes

Versions: 6

Compression:

Stored size: 642 Bytes

Contents

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

6 entries across 6 versions & 1 rubygems

Version Path
reek-3.11 lib/reek/context/singleton_method_context.rb
reek-3.10.2 lib/reek/context/singleton_method_context.rb
reek-3.10.1 lib/reek/context/singleton_method_context.rb
reek-3.10.0 lib/reek/context/singleton_method_context.rb
reek-3.9.1 lib/reek/context/singleton_method_context.rb
reek-3.9.0 lib/reek/context/singleton_method_context.rb