module Qdocs
Constants
- CONST_REGEXP
- Handler
- METHOD_REGEXP
- VERSION
Public Class Methods
load_env(dir_level = nil)
click to toggle source
# File lib/qdocs.rb, line 196 def self.load_env(dir_level = nil) check_dir = dir_level || ["."] project_top_level = Pathname(File.join(*check_dir, "Gemfile")).exist? || Pathname(File.join(*check_dir, ".git")).exist? if project_top_level && Pathname(File.join(*check_dir, "config", "environment.rb")).exist? require File.join(*check_dir, "config", "environment.rb") elsif project_top_level # no op - no env to load else dir_level ||= [] dir_level << ".." Qdocs.load_env(dir_level) end end
lookup(input)
click to toggle source
# File lib/qdocs.rb, line 220 def self.lookup(input) case input when /\A([[:lower:]](?:#{METHOD_REGEXP})?)\z/ Handler::Method.new(input).show(Object, $1, :instance) when /\A(#{CONST_REGEXP})\.(#{METHOD_REGEXP})\z/ Handler::Method.new(input).show($1, $2, :singleton) when /\A(#{CONST_REGEXP})#(#{METHOD_REGEXP})\z/ Handler::Method.new(input).show($1, $2, :instance) when /\A(#{CONST_REGEXP})\z/ Handler::Const.new(input).show($1) when %r{\A(#{CONST_REGEXP})/([^/]+)/\z} Handler::Method.new(input).index($1, Regexp.new($2)) else raise UnknownPatternError, "Unrecognised pattern #{input}" end end