Top Level Namespace
Defined in:
Constant Summary
-
CRYPTIC_DEFAULT_SHEETS =
{computer: "https://github.com/cryptic-resolver/cryptic_computer.git", common: "https://github.com/cryptic-resolver/cryptic_common.git", science: "https://github.com/cryptic-resolver/cryptic_science.git", economy: "https://github.com/cryptic-resolver/cryptic_economy.git", medicine: "https://github.com/cryptic-resolver/cryptic_medicine.git"}
-
CRYPTIC_RESOLVER_HOME =
File.expand_path("~/.cryptic-resolver", home: Path.home)
-
CRYPTIC_VERSION =
"1.1.0"
Method Summary
- add_default_sheet_if_none_exist
- blue(str)
- bold(str)
- cyan(str)
-
directly_lookup(sheet, file, word)
Used for synonym jump Because we absolutely jump to a must-have word So we can directly lookup to it
- green(str)
- help
- is_there_any_sheet?
- load_dictionary(path, file)
-
lookup(sheet, file, word)
Lookup the given word in a dictionary (a toml file in a sheet) and also print.
-
pp_info(info : Hash)
Pretty print the info of the given word
-
pp_sheet(sheet)
Print default cryptic_ sheets
- print_version
- purple(str)
- red(str)
-
solve_word(word)
The main logic of
cr
1. - underline(str)
- update_sheets(sheet_repo)
- yellow(str)
Method Detail
Used for synonym jump Because we absolutely jump to a must-have word So we can directly lookup to it
Notice that, we must jump to a specific word definition So in the toml file, you must specify the precise word. If it has multiple meanings, for example
[blah] same = "XDG" # this is wrong
[blah] same = "XDG.Download" # this is right
Lookup the given word in a dictionary (a toml file in a sheet) and also print. The core idea is that:
-
if the word is
same
with another synonym, it will directly jump to a word in this sheet, but maybe a different dictionary -
load the toml file and check whether it has the only one meaning. 2.1 If yes, then just print it using
pp_info
2.2 If not, then collect all the meanings of the word, and usepp_info
Pretty print the info of the given word
A info looks like this emacs = { disp = "Emacs" desc = "edit macros" full = "a feature-rich editor" see = ["Vim"] }
@param info [Hash] the information of the given word (mapped to a keyword in TOML)
The main logic of cr
- Search the default's first sheet first
- Search the rest sheets in the cryptic sheets default dir
The search
procedure is done via the lookup
function. It
will print the info while finding. If lookup
always return
false then means lacking of this word in our sheets.So a wel-
comed contribution is prinetd on the screen.