Sha256: d15bbae68af7d7f6daae093c435305a7aaa9e4e0186cd1a75ad82c764b467798

Contents?: true

Size: 885 Bytes

Versions: 10

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

module Mutant
  class Subject
    # Abstract base class for method subjects
    class Method < self
      include anima.add(:visibility)

      # 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.raw.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

10 entries across 10 versions & 1 rubygems

Version Path
mutant-0.12.4 lib/mutant/subject/method.rb
mutant-0.12.3 lib/mutant/subject/method.rb
mutant-0.12.2 lib/mutant/subject/method.rb
mutant-0.12.0 lib/mutant/subject/method.rb
mutant-0.11.34 lib/mutant/subject/method.rb
mutant-0.11.33 lib/mutant/subject/method.rb
mutant-0.11.32 lib/mutant/subject/method.rb
mutant-0.11.31 lib/mutant/subject/method.rb
mutant-0.11.30 lib/mutant/subject/method.rb
mutant-0.11.29 lib/mutant/subject/method.rb