Class: RubyIndexer::Entry
- Inherits:
-
Object
- Object
- RubyIndexer::Entry
- Extended by:
- T::Sig
- Defined in:
- lib/ruby_indexer/lib/ruby_indexer/entry.rb
Direct Known Subclasses
Constant, ConstantAlias, InstanceVariable, Member, MethodAlias, Namespace, UnresolvedConstantAlias, UnresolvedMethodAlias
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
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#location ⇒ Object
(also: #name_location)
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#visibility ⇒ Object
Returns the value of attribute visibility.
Instance Method Summary collapse
- #file_name ⇒ Object
-
#initialize(name, file_path, location, comments) ⇒ Entry
constructor
A new instance of Entry.
- #private? ⇒ Boolean
- #protected? ⇒ Boolean
- #public? ⇒ Boolean
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
#comments ⇒ Object (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_path ⇒ Object (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 |
#location ⇒ Object (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 |
#name ⇒ Object (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 |
#visibility ⇒ Object
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_name ⇒ Object
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 |