class Novika::Resolver::Session

Overview

A resolver session interacts with a RunnableRoot in a way that allows you to query. Querying is done by #pushing some queries, and then #popping them "into" a Response object which you should create beforehand, and which you own.

session = Resolver::Session.new(root)
session.push("foo")
session.push("bar")
session.push("baz")

response1 = Resolver::Response.new
session.pop(response1)

# Re-use the same session. Queries were popped, so the session
# is clean.
session.push("xyzzy")
session.push("byzzy")

response2 = Resolver::Response.new
session.pop(response2)

# Run the accepted stuff from the responses...
response1.accepted_set.each_designation(root, &.run)
response2.accepted_set.each_designation(root, &.run)

Defined in:

novika/resolver.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(root : RunnableRoot) #

Instance Method Detail

def each_explicit(& : RunnableQuery -> ) #

Yields only those queries from the query list that were marked as explicit.


def each_query(& : RunnableQuery -> ) #

Yields all queries from the query list.


def on_container_rewritten(&callback : RunnableContainer -> ) #

Registers callback to be called when a runnable container is thoroughly rewritten.


def on_container_rewritten(callback : RunnableContainer -> ) #

Registers callback to be called when a runnable container is thoroughly rewritten.


def pop(response : Response) : ResolutionSet #

Resolves the list of queries that were #pushed, returns the single resolution set comprised of resolutions for those queries that were accepted by the resolver.

Also fills response, see Response for what you can get out of it.


def push(query : RunnableQuery, explicit = false) #

Appends query to the list of queries to be resolved during this session; allows to mark it as explicit ("hand-written") if necessary.


def push(query : Query, explicit = false) #

Appends query to the list of queries to be resolved during this session; allows to mark it as explicit ("hand-written") if necessary.


def push(queries : Array(RunnableQuery), explicit = false) #

Appends the entire array of queries to the list of queries to be resolved during this session; allows to mark all of them as explicit ("hand-written") if necessary.


def push(queries : Array(Query) | Array(String) | Array(Path), explicit = false) #

Appends the entire array of queries to the list of queries to be resolved during this session; allows to mark all of them as explicit ("hand-written") if necessary.