module Redoc
Defined in:
redoc.crredoc/crystal.cr
redoc/transformer.cr
redoc/types.cr
Constant Summary
-
METHOD_PATTERN =
/(?:(?:_\w|[a-z])\w*(?:!|\?|=)?|[-+^`~%|]|\*\*?|\/\/?|!(?:=|~)?|=(?:=|==|~)?|<(?:<|=)?|>(?:>|=)?|<=>|&(?:\+|-|\*)?|\[](?:\?|=)?)/
-
QUERY_PATTERN =
/^(?:(?<dname>(?:::)?#{METHOD_PATTERN})|(?<tpath>(?:(?:::)?[A-Z]\w*)+)(?:(?<tscope>\.|#)(?<tname>#{METHOD_PATTERN}))?)$/
-
VERSION =
"0.1.0"
Class Method Summary
-
.load(source : String | IO) : Library
Loads a library from source.
-
.parse_query(pattern : String) : Tuple(Array(String), String | Nil, QueryScope)
Same as
.parse_query?
but raises anError
if pattern is invalid. -
.parse_query?(pattern : String) : Tuple(Array(String), String | Nil, QueryScope) | Nil
Parses a query from pattern.
Class Method Detail
Loads a library from source. This should be the generated JSON of a Crystal library
which can be obtained from the crystal docs --json
command.
def self.parse_query(pattern : String) : Tuple(Array(String), String | Nil, QueryScope)
#
Same as .parse_query?
but raises an Error
if pattern is invalid.
def self.parse_query?(pattern : String) : Tuple(Array(String), String | Nil, QueryScope) | Nil
#
Parses a query from pattern. Returns an array of strings representing the namespace,
a nilable string representing the symbol, and the query scope (see Library#resolve?
).
The pattern is expected to be in Crystal path format which is defined as follows:
- "::" is used for namespace accessors
- "." is used for class method accessors
- "#" is used for instance method accessors
The following is in valid format:
puts
::puts
String.build
::Char::Reader#pos
This also supports operator methods and methods that end in =
, !
or ?
:
!
Regex#=~
Array#[]?
The following is in invalid format:
to_s.nil?
IO.Memory
JSON#Any