Class: RubyIndexer::VisibilityScope

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb

Overview

Represents the visibility scope in a Ruby namespace. This keeps track of whether methods are in a public, private or protected section, and whether they are module functions.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(visibility: :public, module_func: false) ⇒ VisibilityScope

: (?visibility: Symbol, ?module_func: bool) -> void



27
28
29
30
# File 'lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb', line 27

def initialize(visibility: :public, module_func: false)
  @visibility = visibility
  @module_func = module_func
end

Instance Attribute Details

#module_funcObject (readonly)

: bool



24
25
26
# File 'lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb', line 24

def module_func
  @module_func
end

#visibilityObject (readonly)

: Symbol



21
22
23
# File 'lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb', line 21

def visibility
  @visibility
end

Class Method Details

.module_function_scopeObject

: -> instance



10
11
12
# File 'lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb', line 10

def module_function_scope
  new(module_func: true, visibility: :private)
end

.public_scopeObject

: -> instance



15
16
17
# File 'lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb', line 15

def public_scope
  new
end