Sha256: c673e8f16274ca4b200a743f1d3319db20ab1927da23dfd44775650a352757b3

Contents?: true

Size: 672 Bytes

Versions: 28

Compression:

Stored size: 672 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

28 entries across 28 versions & 1 rubygems

Version Path
reek-4.6.1 lib/reek/context/singleton_method_context.rb
reek-4.6.0 lib/reek/context/singleton_method_context.rb
reek-4.5.6 lib/reek/context/singleton_method_context.rb
reek-4.5.5 lib/reek/context/singleton_method_context.rb
reek-4.5.4 lib/reek/context/singleton_method_context.rb
reek-4.5.3 lib/reek/context/singleton_method_context.rb
reek-4.5.2 lib/reek/context/singleton_method_context.rb
reek-4.5.1 lib/reek/context/singleton_method_context.rb
reek-4.5.0 lib/reek/context/singleton_method_context.rb
reek-4.4.2 lib/reek/context/singleton_method_context.rb
reek-4.4.1 lib/reek/context/singleton_method_context.rb
reek-4.4.0 lib/reek/context/singleton_method_context.rb
reek-4.3.0 lib/reek/context/singleton_method_context.rb
reek-4.2.5 lib/reek/context/singleton_method_context.rb
reek-4.2.4 lib/reek/context/singleton_method_context.rb
reek-4.2.3 lib/reek/context/singleton_method_context.rb
reek-4.2.2 lib/reek/context/singleton_method_context.rb
reek-4.2.1 lib/reek/context/singleton_method_context.rb
reek-4.2.0 lib/reek/context/singleton_method_context.rb
reek-4.1.1 lib/reek/context/singleton_method_context.rb