abstract class Novika::Resolver::Runnable

Overview

Base class of all runnables.

The main basic property of all runnables is that they can be rewritten into other runnables, oftentimes of a more specific kind. Additionally, runnable objects are the head of their history linked list, allowing clients to observe how the runnable of interest came to be.

Included Modules

Direct Known Subclasses

Defined in:

novika/resolver.cr

Constructors

Instance Method Summary

Instance methods inherited from module Novika::Resolver::Runnable::Ancestor

ancestor? : Ancestor | Nil ancestor?

Constructor Detail

def self.new(ancestor : Ancestor | Nil = nil) #

[View source]

Instance Method Detail

def ancestor? : Ancestor | Nil #

Returns the ancestor of this runnable, or nil if there is no ancestor.


[View source]
def ancestors : Array(Ancestor) #

Returns an array of ancestors of this runnable, starting from the most recent ancestor and ending with the oldest one.


[View source]
def backtrace(io : IO, indent : Int32 = 0, annex : String | Nil = nil) #

Appends ancestors of this runnable (its "history") to io.

indent can be used to specify the amount of whitespace preceding each line.

annex is the additional bit of text displayed below the backtrace. For instance, in case of an error, it can contain the error message.


[View source]
def backtrace(*args, **kwargs, & : IO -> ) #

Yields an IO where you can write the annex, otherwise the same as #backtrace.


[View source]
def constituents : Array(Runnable) #

Returns an array with contained runnables. If none, returns an array with self.


[View source]
def each_ancestor(& : Ancestor -> ) #

Yields ancestors of this runnable.

By tracing the ancestry of self, you are effectively exploring how it came to be.


[View source]
abstract def specialize(root : RunnableRoot, container : RunnableContainer) #

Further specializes this runnable. Appends the specialized runnable to (or interacts in some other way with) container. The latter is assumed to be incomplete (or partially complete, which is really the same thing).

root is the runnable root object. It is mainly used for flags and thorough rewriting.


[View source]