Sha256: ee5189a6090f9af7ca4937d5fce7e643883f025fdb163eea8d7203a8eedd213c

Contents?: true

Size: 871 Bytes

Versions: 8

Compression:

Stored size: 871 Bytes

Contents

module Mutest
  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 # Mutest

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutest-0.0.9 lib/mutest/subject/method.rb
mutest-0.0.8 lib/mutest/subject/method.rb
mutest-0.0.7 lib/mutest/subject/method.rb
mutest-0.0.6 lib/mutest/subject/method.rb
mutest-0.0.5 lib/mutest/subject/method.rb
mutest-0.0.4 lib/mutest/subject/method.rb
mutest-0.0.3 lib/mutest/subject/method.rb
mutest-0.0.2 lib/mutest/subject/method.rb