Sha256: 194aa557c3b4cd87b2b35ec9c1cfe446020a6608cb43568d8f50cbf49b1e207d

Contents?: true

Size: 871 Bytes

Versions: 8

Compression:

Stored size: 871 Bytes

Contents

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

      # Method name
      #
      # @return [Expression]
      def name
        node.children.fetch(self.class::NAME_INDEX)
      end

      # Match expression
      #
      # @return [String]
      def expression
        Expression::Method.new(
          method_name:  name.to_s,
          scope_symbol: self.class::SYMBOL,
          scope_name:   scope.name
        )
      end
      memoize :expression

      # Match expressions
      #
      # @return [Array<Expression>]
      def match_expressions
        [expression].concat(context.match_expressions)
      end
      memoize :match_expressions

    private

      # The scope
      #
      # @return [Class, Module]
      def scope
        context.scope
      end

    end # Method
  end # Subject
end # Mutant

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.8.16 lib/mutant/subject/method.rb
mutant-0.8.15 lib/mutant/subject/method.rb
mutant-0.8.14 lib/mutant/subject/method.rb
mutant-0.8.13 lib/mutant/subject/method.rb
mutant-0.8.12 lib/mutant/subject/method.rb
mutant-0.8.11 lib/mutant/subject/method.rb
mutant-0.8.10 lib/mutant/subject/method.rb
mutant-0.8.9 lib/mutant/subject/method.rb