Sha256: 5f91962a0e9b2d18b9e308164f2fe9d7804bcf5ac03f1d1bf067d25420a7fc24

Contents?: true

Size: 786 Bytes

Versions: 2

Compression:

Stored size: 786 Bytes

Contents

module Mutant
  class Subject
    class Method
      # Singleton method subjects
      class Singleton < self

        NAME_INDEX = 1
        SYMBOL = '.'.freeze

        # Test if method is public
        #
        # @return [true]
        #   if method is public
        #
        # @return [false]
        #   otherwise
        #
        # @api private
        #
        def public?
          scope.singleton_class.public_method_defined?(name)
        end
        memoize :public?

        # Prepare subject for mutation insertion
        #
        # @return [self]
        #
        # @api private
        #
        def prepare
          scope.singleton_class.send(:undef_method, name)
          self
        end

      end # Singleton
    end # Method
  end # Subject
end # Mutant

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.5.21 lib/mutant/subject/method/singleton.rb
mutant-0.5.20 lib/mutant/subject/method/singleton.rb