Sha256: 10ea474e42600572d6df31f5356f7c0562225da5db110999ec7d211fe0cfb800

Contents?: true

Size: 844 Bytes

Versions: 45

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

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

      def scope
        context.scope
      end

    end # Method
  end # Subject
end # Mutant

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
mutant-0.11.4 lib/mutant/subject/method.rb
mutant-0.11.3 lib/mutant/subject/method.rb
mutant-0.11.2 lib/mutant/subject/method.rb
mutant-0.11.1 lib/mutant/subject/method.rb
mutant-0.11.0 lib/mutant/subject/method.rb
mutant-0.10.35 lib/mutant/subject/method.rb
mutant-0.10.34 lib/mutant/subject/method.rb
mutant-0.10.33 lib/mutant/subject/method.rb
mutant-0.10.32 lib/mutant/subject/method.rb
mutant-0.10.31 lib/mutant/subject/method.rb
mutant-0.10.30 lib/mutant/subject/method.rb
mutant-0.10.29 lib/mutant/subject/method.rb
mutant-0.10.28 lib/mutant/subject/method.rb
mutant-0.10.27 lib/mutant/subject/method.rb
mutant-0.10.26 lib/mutant/subject/method.rb
mutant-0.10.25 lib/mutant/subject/method.rb
mutant-0.10.24 lib/mutant/subject/method.rb
mutant-0.10.23 lib/mutant/subject/method.rb
mutant-0.10.22 lib/mutant/subject/method.rb
mutant-0.10.21 lib/mutant/subject/method.rb