Sha256: f4a9febbb0017b552a6ebc7d5b39f3cb1494f58865f7709a6711bdb13d2e5a9e

Contents?: true

Size: 805 Bytes

Versions: 13

Compression:

Stored size: 805 Bytes

Contents

# encoding: utf-8

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

13 entries across 13 versions & 1 rubygems

Version Path
mutant-0.5.19 lib/mutant/subject/method/singleton.rb
mutant-0.5.18 lib/mutant/subject/method/singleton.rb
mutant-0.5.17 lib/mutant/subject/method/singleton.rb
mutant-0.5.16 lib/mutant/subject/method/singleton.rb
mutant-0.5.15 lib/mutant/subject/method/singleton.rb
mutant-0.5.14 lib/mutant/subject/method/singleton.rb
mutant-0.5.13 lib/mutant/subject/method/singleton.rb
mutant-0.5.12 lib/mutant/subject/method/singleton.rb
mutant-0.5.11 lib/mutant/subject/method/singleton.rb
mutant-0.5.10 lib/mutant/subject/method/singleton.rb
mutant-0.5.9 lib/mutant/subject/method/singleton.rb
mutant-0.5.8 lib/mutant/subject/method/singleton.rb
mutant-0.5.7 lib/mutant/subject/method/singleton.rb