Sha256: 536a238674e2a4dce09e0904c58982dd1dccadaf9ce30a0226be073ee888d061

Contents?: true

Size: 902 Bytes

Versions: 17

Compression:

Stored size: 902 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

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

    end # Method
  end # Subject
end # Mutant

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mutant-0.9.8 lib/mutant/subject/method.rb
mutant-0.9.7 lib/mutant/subject/method.rb
mutant-0.9.6 lib/mutant/subject/method.rb
mutant-0.9.5 lib/mutant/subject/method.rb
mutant-0.9.4 lib/mutant/subject/method.rb
mutant-0.9.3 lib/mutant/subject/method.rb
mutant-0.9.2 lib/mutant/subject/method.rb
mutant-0.9.1 lib/mutant/subject/method.rb
mutant-0.9.0 lib/mutant/subject/method.rb
mutant-0.8.24 lib/mutant/subject/method.rb
mutant-0.8.23 lib/mutant/subject/method.rb
mutant-0.8.22 lib/mutant/subject/method.rb
mutant-0.8.21 lib/mutant/subject/method.rb
mutant-0.8.20 lib/mutant/subject/method.rb
mutant-0.8.19 lib/mutant/subject/method.rb
mutant-0.8.18 lib/mutant/subject/method.rb
mutant-0.8.17 lib/mutant/subject/method.rb