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

Method Detail

def add_default_sheet_if_none_exist #

[View source]
def blue(str) #

[View source]
def bold(str) #

[View source]
def cyan(str) #

[View source]
def 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

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


[View source]
def green(str) #

[View source]
def help #

[View source]
def is_there_any_sheet? #

[View source]
def load_dictionary(path, file) #

[View source]
def lookup(sheet, file, word) #

Lookup the given word in a dictionary (a toml file in a sheet) and also print. The core idea is that:

  1. if the word is same with another synonym, it will directly jump to a word in this sheet, but maybe a different dictionary

  2. 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 use pp_info


[View source]
def pp_info(info : Hash) #

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)


[View source]
def pp_sheet(sheet) #

Print default cryptic_ sheets


[View source]
def print_version #

[View source]
def purple(str) #

[View source]
def red(str) #

[View source]
def solve_word(word) #

The main logic of cr

  1. Search the default's first sheet first
  2. 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.


[View source]
def underline(str) #

[View source]
def update_sheets(sheet_repo) #

[View source]
def yellow(str) #

[View source]