module Rcodetools::XMPDocFilter::UseMethodAnalyzer

Constants

METHOD_ANALYSIS

Public Instance Methods

_doc(code, lineno, column=nil) click to toggle source
# File lib/rcodetools/doc.rb, line 117
def _doc(code, lineno, column=nil)
  find_method_analysis do |ma_file|
    methods = open(ma_file, "rb"){ |f| Marshal.load(f)}
    line = File.readlines(@filename)[lineno-1]
    current_method = line[ /^.{#{column}}\w*/][ /\w+[\?!]?$/ ].sub(/:+/,'')
    filename = @filename  # FIXME
    begin 
      methods[filename][lineno].grep(Regexp.new(Regexp.quote(current_method)))[0]
    rescue NoMethodError
      raise "doc/method_analyzer:cannot find #{current_method}"
    end

  end
end
find_method_analysis() { |join(here, METHOD_ANALYSIS)| ... } click to toggle source
# File lib/rcodetools/doc.rb, line 100
def find_method_analysis
  here = Dir.pwd
  oldpwd = here
  begin
    while ! have_method_analysis
      Dir.chdir("..")
      if Dir.pwd == here
        return nil          # not found
      end
      here = Dir.pwd
    end
  ensure
    Dir.chdir oldpwd
  end
  yield(File.join(here, METHOD_ANALYSIS))
end
have_method_analysis() click to toggle source
# File lib/rcodetools/doc.rb, line 96
def have_method_analysis
  File.file? METHOD_ANALYSIS
end