Sha256: d6643cfc801a1d7785fbac7b0d627901b80c9a0cdc1363faf41a43beba8e1de5

Contents?: true

Size: 653 Bytes

Versions: 69

Compression:

Stored size: 653 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.singleton_class.public_send(: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

69 entries across 69 versions & 1 rubygems

Version Path
mutant-0.11.28 lib/mutant/subject/method/metaclass.rb
mutant-0.11.27 lib/mutant/subject/method/metaclass.rb
mutant-0.11.26 lib/mutant/subject/method/metaclass.rb
mutant-0.11.25 lib/mutant/subject/method/metaclass.rb
mutant-0.11.24 lib/mutant/subject/method/metaclass.rb
mutant-0.11.23 lib/mutant/subject/method/metaclass.rb
mutant-0.11.22 lib/mutant/subject/method/metaclass.rb
mutant-0.11.21 lib/mutant/subject/method/metaclass.rb
mutant-0.11.20 lib/mutant/subject/method/metaclass.rb
mutant-0.11.19 lib/mutant/subject/method/metaclass.rb
mutant-0.11.18 lib/mutant/subject/method/metaclass.rb
mutant-0.11.17 lib/mutant/subject/method/metaclass.rb
mutant-0.11.16 lib/mutant/subject/method/metaclass.rb
mutant-0.11.15 lib/mutant/subject/method/metaclass.rb
mutant-0.11.14 lib/mutant/subject/method/metaclass.rb
mutant-0.11.13 lib/mutant/subject/method/metaclass.rb
mutant-0.11.12 lib/mutant/subject/method/metaclass.rb
mutant-0.11.11 lib/mutant/subject/method/metaclass.rb
mutant-0.11.10 lib/mutant/subject/method/metaclass.rb
mutant-0.11.9 lib/mutant/subject/method/metaclass.rb