Sha256: 1bd570bf89a74a6213835bbaf4db64ead818dbd0319084d9abe30af3f5c1d889

Contents?: true

Size: 634 Bytes

Versions: 6

Compression:

Stored size: 634 Bytes

Contents

require 'reek/code_context'

module Reek
  class ModuleContext < CodeContext

    def ModuleContext.create(outer, exp)
      res = Name.resolve(exp[1], outer)
      ModuleContext.new(res[0], res[1])
    end

    def initialize(outer, name)
      super(outer, nil)
      @name = name
    end

    def myself
      @myself ||= @outer.find_module(@name)
    end

    def find_module(modname)
      return nil unless myself
      sym = modname.to_s
      myself.const_defined?(sym) ? myself.const_get(sym) : nil
    end

    def outer_name
      "#{@outer.outer_name}#{@name}::"
    end

    def variable_names
      []
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
kevinrutherford-reek-0.3.1.4 lib/reek/module_context.rb
kevinrutherford-reek-0.3.1.5 lib/reek/module_context.rb
kevinrutherford-reek-0.3.1.6 lib/reek/module_context.rb
kevinrutherford-reek-1.0.0 lib/reek/module_context.rb
kevinrutherford-reek-1.0.1 lib/reek/module_context.rb
reek-1.0.0 lib/reek/module_context.rb