Sha256: e3c7bcbf1d31742be9e5e47b0343a412c087df8ff265315607f237acf4e12fbd

Contents?: true

Size: 643 Bytes

Versions: 10

Compression:

Stored size: 643 Bytes

Contents

# frozen_string_literal: true

module Mutant
  class Subject
    class Method
      # Singleton method defined using metaclass syntax
      # (class << self; def foo; end; end)
      class Metaclass < self
        include AST::Sexp

        NAME_INDEX = 0
        SYMBOL     = '.'

        # Prepare subject for mutation insertion
        #
        # @return [self]
        def prepare
          scope.raw.singleton_class.undef_method(name)
          self
        end

      private

        def wrap_node(mutant)
          s(:sclass, AST::Nodes::N_SELF, mutant)
        end
      end # Metaclass
    end # Method
  end # Subject
end # Mutant

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mutant-0.12.4 lib/mutant/subject/method/metaclass.rb
mutant-0.12.3 lib/mutant/subject/method/metaclass.rb
mutant-0.12.2 lib/mutant/subject/method/metaclass.rb
mutant-0.12.0 lib/mutant/subject/method/metaclass.rb
mutant-0.11.34 lib/mutant/subject/method/metaclass.rb
mutant-0.11.33 lib/mutant/subject/method/metaclass.rb
mutant-0.11.32 lib/mutant/subject/method/metaclass.rb
mutant-0.11.31 lib/mutant/subject/method/metaclass.rb
mutant-0.11.30 lib/mutant/subject/method/metaclass.rb
mutant-0.11.29 lib/mutant/subject/method/metaclass.rb