Sha256: 9bd0d2d4f4f4bbbdc9476d77a54428722b08e22c9c9c1066d527f886f1f2017b

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

module Mutant
  class Subject
    # Abstract base class for method subjects
    class Method < self

      # Test if method is public
      #
      # @return [Boolean]
      #
      # @api private
      #
      abstract_method :public?

      # Return method name
      #
      # @return [Symbol]
      #
      # @api private
      #
      def name
        node.children[self.class::NAME_INDEX]
      end

      # Return match expression
      #
      # @return [String]
      #
      # @api private
      #
      def match_expression
        "#{context.identification}#{self.class::SYMBOL}#{name}"
      end

    private

      # Return mutations
      #
      # @param [#<<] emitter
      #
      # @return [undefined]
      #
      # @api private
      #
      def generate_mutations(emitter)
        emitter << noop_mutation
        Mutator.each(node) do |mutant|
          emitter << Mutation::Evil.new(self, mutant)
        end
      end

      # Return scope
      #
      # @return [Class, Module]
      #
      # @api private
      #
      def scope
        context.scope
      end

    end # Method
  end # Subject
end # Mutant

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.5.23 lib/mutant/subject/method.rb
mutant-0.5.22 lib/mutant/subject/method.rb