Class: RubyIndexer::Entry

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/ruby_indexer/lib/ruby_indexer/entry.rb

Defined Under Namespace

Classes: Accessor, BlockParameter, Class, Constant, ConstantAlias, Include, InstanceVariable, KeywordParameter, KeywordRestParameter, Member, Method, MethodAlias, Module, ModuleOperation, Namespace, OptionalKeywordParameter, OptionalParameter, Parameter, Prepend, RequiredParameter, RestParameter, Signature, SingletonClass, UnresolvedConstantAlias, UnresolvedMethodAlias, Visibility

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, file_path, location, comments) ⇒ Entry



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 41

def initialize(name, file_path, location, comments)
  @name = name
  @file_path = file_path
  @comments = comments
  @visibility = T.let(Visibility::PUBLIC, Visibility)

  @location = T.let(
    if location.is_a?(Prism::Location)
      Location.new(
        location.start_line,
        location.end_line,
        location.start_column,
        location.end_column,
      )
    else
      location
    end,
    RubyIndexer::Location,
  )
end

Instance Attribute Details

#commentsObject (readonly)

Returns the value of attribute comments.



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

def comments
  @comments
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



20
21
22
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 20

def file_path
  @file_path
end

#locationObject (readonly) Also known as: name_location

Returns the value of attribute location.



23
24
25
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 23

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 17

def name
  @name
end

#visibilityObject

Returns the value of attribute visibility.



31
32
33
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 31

def visibility
  @visibility
end

Instance Method Details

#file_nameObject



78
79
80
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 78

def file_name
  File.basename(@file_path)
end

#private?Boolean



73
74
75
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 73

def private?
  visibility == Visibility::PRIVATE
end

#protected?Boolean



68
69
70
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 68

def protected?
  visibility == Visibility::PROTECTED
end

#public?Boolean



63
64
65
# File 'lib/ruby_indexer/lib/ruby_indexer/entry.rb', line 63

def public?
  visibility == Visibility::PUBLIC
end