Module: Qdocs
- Defined in:
- lib/qdocs.rb,
lib/qdocs/server.rb,
lib/qdocs/version.rb
Defined Under Namespace
Modules: Helpers Classes: Const, Method, Server, UnknownClassError, UnknownMethodError, UnknownMethodTypeError, UnknownPatternError
Constant Summary collapse
- METHOD_REGEXP =
/(?:[a-zA-Z_]+|\[\])[?!=]?/.freeze
- CONST_REGEXP =
/[[:upper:]]\w*(?:::[[:upper:]]\w*)*/.freeze
- VERSION =
"0.1.0"
Class Method Summary collapse
Class Method Details
.lookup(input) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/qdocs.rb', line 128 def self.lookup(input) case input when /\A([[:lower:]](?:#{METHOD_REGEXP})?)\z/ Qdocs::Method.new.show(Object, $1, :instance) when /\A(#{CONST_REGEXP})\.(#{METHOD_REGEXP})\z/ Qdocs::Method.new.show($1, $2, :singleton) when /\A(#{CONST_REGEXP})#(#{METHOD_REGEXP})\z/ Qdocs::Method.new.show($1, $2, :instance) when /\A(#{CONST_REGEXP})\z/ Qdocs::Const.new.show($1) when %r{\A(#{CONST_REGEXP})/([^/]+)/\z} Qdocs::Method.new.index($1, Regexp.new($2)) else raise UnknownPatternError, "Unrecognised pattern #{input}" end end |