class FastRI::RiIndex::MethodEntry

Attributes

full_name[R]
index[R]
name[R]
source_index[R]

Public Class Methods

new(ri_index, fullname, index, source_index) click to toggle source
# 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

Public Instance Methods

instance_method?() click to toggle source
# File lib/fastri/ri_index.rb, line 112
def instance_method?
  !singleton_method?
end
path_name() click to toggle source

Returns the “fully resolved” file name of the yaml containing our description.

# 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?() click to toggle source
# File lib/fastri/ri_index.rb, line 108
def singleton_method?
  /\.[^:]+$/ =~ @full_name
end
type() click to toggle source

Returns the type of this entry (:method).

# File lib/fastri/ri_index.rb, line 117
def type
  :method
end