class Solargraph::Pin::Namespace

def initialize type: :class, visibility: :public, gates: [''], **splat

Parameters:
  • gates (::Array) --
  • visibility (::Symbol) -- :public or :private
  • type (::Symbol) -- :class or :module
def initialize type: :class, visibility: :public, gates: [''], **splat
  # super(location, namespace, name, comments)

  super(**splat)
  @type = type
  @visibility = visibility
  if name.start_with?('::')
    @name = name[2..-1]
    @closure = Solargraph::Pin::ROOT_PIN
  end
  @open_gates = gates
  if @name.include?('::')
    # In this case, a chained namespace was opened (e.g., Foo::Bar)

    # but Foo does not exist.

    parts = @name.split('::')
    @name = parts.pop
    closure_name = if [Solargraph::Pin::ROOT_PIN, nil].include?(closure)
      ''
    else
      closure.full_context.namespace + '::'
    end
    closure_name += parts.join('::')
    @closure = Pin::Namespace.new(name: closure_name, gates: [parts.join('::')])
    @context = nil
  end
end