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.


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

Ends the program with the given exit code.


def monotonic(engine) : Decimal #
Description copied from class Novika::Capabilities::ISystem

Returns a reading from the monotonic clock, in milliseconds.


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

Sleeps for the given amount of milliseconds.


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.


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

Extended (contextful) version of #readline.


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

Reports abound an error to the standard error stream.