class Novika::Capabilities::Impl::System

Defined in:

novika/capabilities/impl/system.cr

Instance Method Summary

Instance methods inherited from class Novika::Capabilities::ISystem

append_echo(engine, form : Form) append_echo, bye(engine, code : Decimal) bye, inject(into target : Block) inject, monotonic(engine) : Decimal monotonic, nap(engine, millis : Decimal) nap, readline(engine, prompt : Form) : Tuple(Quote | Nil, Boolean) readline, readline_star(engine, config : PromptConfig) : Tuple(Quote | Nil, Boolean) readline_star, report_error(engine, error : Error) report_error

Class methods inherited from class Novika::Capabilities::ISystem

id : String id, on_by_default? : Bool on_by_default?, purpose : String purpose

Instance methods inherited from module Novika::ICapability

capabilities : CapabilityCollection capabilities, inject(into target : Block) inject

Constructor methods inherited from module Novika::ICapability

new(capabilities) new

Instance Method Detail

def append_echo(engine, form : Form) #
Description copied from class Novika::Capabilities::ISystem

Enquotes and appends form to the standard output stream.


[View source]
def bye(engine, code : Decimal) #
Description copied from class Novika::Capabilities::ISystem

Ends the program with the given exit code.


[View source]
def monotonic(engine) : Decimal #
Description copied from class Novika::Capabilities::ISystem

Returns a reading from the monotonic clock, in milliseconds.


[View source]
def nap(engine, millis : Decimal) #
Description copied from class Novika::Capabilities::ISystem

Sleeps for the given amount of milliseconds.


[View source]
def readline(engine, prompt : Form) : Tuple(Quote | Nil, Boolean) #
Description copied from class Novika::Capabilities::ISystem

Enquotes and prints prompt to STDOUT. Waits for the user to answer, enquotes the answer (if any) and returns it together with a status boolean.

If the user answered with EOF (e.g. CTRL-D), status bool is false and answer quote is nil. Else, answer quote contains the answer and status bool is true.


[View source]
def readline_star(engine, config : PromptConfig) : Tuple(Quote | Nil, Boolean) #
Description copied from class Novika::Capabilities::ISystem

Extended (contextful) version of #readline.


[View source]
def report_error(engine, error : Error) #
Description copied from class Novika::Capabilities::ISystem

Reports abound an error to the standard error stream.


[View source]