Top Level Namespace
Defined in:
Constant Summary
-
EXAMPLE_CONFIG =
"#{Style.dim("exampleconfig.yml")}\n#{Style.dim("====")}\n#{Style.blue("search_terms")}: #{Style.green("\"lyrics\"")}\n#{Style.blue("binary_directory")}: #{Style.green("~/.irs/bin")}\n#{Style.blue("music_directory")}: #{Style.green("~/Music")}\n#{Style.blue("filename_pattern")}: #{Style.green("\"{track_number} - {title}\"")}\n#{Style.blue("directory_pattern")}: #{Style.green("\"{artist}/{album}\"")}\n#{Style.blue("client_key")}: #{Style.green("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")}\n#{Style.blue("client_secret")}: #{Style.green("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")}\n#{Style.blue("single_folder_playlist")}: \n #{Style.blue("enabled")}: #{Style.green("true")}\n #{Style.blue("retain_playlist_order")}: #{Style.green("true")}\n #{Style.blue("unify_into_album")}: #{Style.green("false")}\n#{Style.dim("====")}"
Method Summary
-
delay(delay, &block : -> _)
Spawns a
Fiber
to compute &block in the background after delay has elapsed. -
future(&exp : -> _)
Spawns a
Fiber
to compute &block in the background. -
lazy(&block : -> _)
Conditionally spawns a
Fiber
to run &block in the background. - main
- parse_to_json(string_json : String) : JSON::Any
Method Detail
def delay(delay, &block : -> _)
#
Spawns a Fiber
to compute &block in the background after delay has elapsed.
Access to get is synchronized between fibers. &block is only called once.
May be canceled before &block is called by calling cancel
.
d = delay(1) { Process.kill(Process.pid) }
long_operation
d.cancel
def future(&exp : -> _)
#
Spawns a Fiber
to compute &block in the background.
Access to get is synchronized between fibers. &block is only called once.
f = future { http_request }
... other actions ...
f.get #=> String
def lazy(&block : -> _)
#
Conditionally spawns a Fiber
to run &block in the background.
Access to get is synchronized between fibers. &block is only called once.
&block doesn't run by default, only when get
is called.
l = lazy { expensive_computation }
spawn { maybe_use_computation(l) }
spawn { maybe_use_computation(l) }