Sha256: 39a96e9a823b47af58a71c64daedcd0bba916b4abcb87c508eb02009c176838e

Contents?: true

Size: 654 Bytes

Versions: 3

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true

require_relative 'code_context'
require_relative 'method_context'

module Reek
  module Context
    #
    # A context wrapper representing the root of an abstract syntax tree.
    #
    class RootContext < CodeContext
      def initialize(exp)
        super(nil, exp)
      end

      def type
        :root
      end

      def full_name
        ''
      end

      # Return the correct class for child method contexts (representing nodes
      # of type `:def`). For RootContext, this is the class that represents
      # instance methods.
      def method_context_class
        MethodContext
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reek-4.7.1 lib/reek/context/root_context.rb
reek-4.7.0 lib/reek/context/root_context.rb
reek-4.6.2 lib/reek/context/root_context.rb