Class: FastRI::RiIndex::MethodEntry
- Inherits:
-
Object
- Object
- FastRI::RiIndex::MethodEntry
- Defined in:
- lib/fastri/ri_index.rb
Instance Attribute Summary collapse
-
#full_name ⇒ Object
readonly
Returns the value of attribute full_name.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source_index ⇒ Object
readonly
Returns the value of attribute source_index.
Instance Method Summary collapse
-
#initialize(ri_index, fullname, index, source_index) ⇒ MethodEntry
constructor
A new instance of MethodEntry.
- #instance_method? ⇒ Boolean
-
#path_name ⇒ Object
Returns the “fully resolved” file name of the yaml containing our description.
- #singleton_method? ⇒ Boolean
-
#type ⇒ Object
Returns the type of this entry (
:method
).
Constructor Details
#initialize(ri_index, fullname, index, source_index) ⇒ MethodEntry
Returns a new instance of MethodEntry.
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fastri/ri_index.rb', line 74 def initialize(ri_index, fullname, index, source_index) # index is the index in ri_index' array # source_index either nil (all scopes) or the integer referencing the # path (-> we'll do @ri_index.paths[@source_index]) @ri_index = ri_index @full_name = fullname @name = fullname[/[.#](.*)$/, 1] @index = index @source_index = source_index end |
Instance Attribute Details
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
72 73 74 |
# File 'lib/fastri/ri_index.rb', line 72 def full_name @full_name end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
72 73 74 |
# File 'lib/fastri/ri_index.rb', line 72 def index @index end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
72 73 74 |
# File 'lib/fastri/ri_index.rb', line 72 def name @name end |
#source_index ⇒ Object (readonly)
Returns the value of attribute source_index.
72 73 74 |
# File 'lib/fastri/ri_index.rb', line 72 def source_index @source_index end |
Instance Method Details
#instance_method? ⇒ Boolean
112 113 114 |
# File 'lib/fastri/ri_index.rb', line 112 def instance_method? !singleton_method? end |
#path_name ⇒ Object
Returns the “fully resolved” file name of the yaml containing our description.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/fastri/ri_index.rb', line 87 def path_name prefix = @full_name.split(/::|[#.]/)[0..-2] case @source_index when nil ## we'd like to do #@ri_index.source_paths_for(self).map do |path| # File.join(File.join(path, *prefix), RI::RiWriter.internal_to_external(@name)) #end # but RI doesn't support merging at the method-level, so path = @ri_index.source_paths_for(self).first File.join(File.join(path, *prefix), RI::RiWriter.internal_to_external(@name) + (singleton_method? ? "-c" : "-i" ) + ".yaml") else path = @ri_index.paths[@source_index] File.join(File.join(path, *prefix), RI::RiWriter.internal_to_external(@name) + (singleton_method? ? "-c" : "-i" ) + ".yaml") end end |
#singleton_method? ⇒ Boolean
108 109 110 |
# File 'lib/fastri/ri_index.rb', line 108 def singleton_method? /\.[^:]+$/ =~ @full_name end |
#type ⇒ Object
Returns the type of this entry (:method
).
117 118 119 |
# File 'lib/fastri/ri_index.rb', line 117 def type :method end |