module Dusic::Misc
Extended Modules
Direct including types
Defined in:
dusic/misc.crInstance Method Summary
-
#await(timeout : Time::Span = 10.seconds, interval : Time::Span = 250.milliseconds, &) : Bool
Loops and calls provided block.
-
#color(key : String) : UInt32 | Nil
Return named color UInt32 which can be accepted by Discord
-
#format_seconds(ts : Time::Span) : String
Format time span in format of HH:MM:SS
- #format_seconds(seconds : Int32) : String
-
#ms_since(time : Time) : Float64
Return milliseconds since moment
-
#run_gc
Manually run GC and log some of it stats
-
#spawn(name : String | Nil = nil, same_thread : Bool = false, &block) : Fiber
Wrapper around default
#spawn
method TODO: Currently it seems to have no use. -
#t(key : String, options : Hash | NamedTuple | Nil = nil, force_locale = nil, count = nil, default = nil, iter = nil, &block : -> String) : String
Wrapper over I18n.translate
- #t(*args, **opts) : String
Instance Method Detail
Loops and calls provided block. Stops when timeout is hit (result will be false
) or block
returns truthy value (result will be true
)
Wrapper around default #spawn
method
TODO Currently it seems to have no use. Consider deleting
def t(key : String, options : Hash | NamedTuple | Nil = nil, force_locale = nil, count = nil, default = nil, iter = nil, &block : -> String) : String
#
Wrapper over I18n.translate