Sha256: d493b3810e0dc3abe15761cd05cb80f8d7dd225ba5d499d5a0224f9cb1f24962

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

module Mutant
  class Matcher
    class Method
      # Matcher for instance methods
      class Instance < self
        SUBJECT_CLASS = Subject::Method::Instance

        # Return identification
        #
        # @return [String]
        #
        # @api private
        #
        def identification
          "#{scope.name}##{method_name}"
        end
        memoize :identification

        NAME_INDEX = 0

      private

        # Check if node is matched
        #
        # @param [Parser::AST::Node] node
        #
        # @return [true]
        #   returns true if node matches method
        #
        # @return [false]
        #   returns false if node NOT matches method
        #
        # @api private
        #
        def match?(node)
          location                  = node.location       || return
          expression                = location.expression || return
          expression.line           == source_line &&
          node.type                 == :def        &&
          node.children[NAME_INDEX] == method_name
        end

      end # Instance
    end # Method
  end # Matcher
end # Mutant

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mutant-0.3.0.beta8 lib/mutant/matcher/method/instance.rb
mutant-0.3.0.beta7 lib/mutant/matcher/method/instance.rb
mutant-0.3.0.beta6 lib/mutant/matcher/method/instance.rb
mutant-0.3.0.beta5 lib/mutant/matcher/method/instance.rb
mutant-0.3.0.beta4 lib/mutant/matcher/method/instance.rb
mutant-0.3.0.beta3 lib/mutant/matcher/method/instance.rb
mutant-0.3.0.beta2 lib/mutant/matcher/method/instance.rb