class RemiLib::Config::ResolverSet

Overview

The ResolverSet allows a collection of Resolver instances to be used in a prioritized way.

Defined in:

remilib/config/resolverset.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(*res : Resolver) #

Creates a new ResolverSet instance.


[View source]

Instance Method Detail

def <<(res : Resolver) #

Appends a Resolver to the end of this set.


[View source]
def [](idx : Int) #

Returns the Resolver at the given index.


[View source]
def dataFile(symname : Symbol) : Path #

Given a symbolic name for a data file, this looks at each Resolver in the order it appears in this set. The first Resolver that knows about the data file will return the Path associated with it.

If the symbol is not registered with any Resolvers in this set, then this raises an UnknownDataFileError.


[View source]
def dataFile(symname : Symbol, &) : Nil #

Given a symbolic name for a data file, this looks at each Resolver in the order it appears in the set. The first Resolver that knows about the data file will then open a new File stream and yield it. If the symbol is not registered with any Resolver, then this raises an UnknownDataFileError.


[View source]
def dataFile?(symname : Symbol) : Path | Nil #

Given a symbolic name for a data file, this looks at each Resolver in the order it appears in this set. The first Resolver that knows about the data file will return the Path associated with it.

If the symbol is not registered with any Resolvers in this set, then this returns nil.


[View source]
def dataFile?(symname : Symbol, &) : Bool #

Given a symbolic name for a data file, this looks at each Resolver in the order it appears in the set. The first Resolver that knows about the data file will then open a new File stream and yield it, then return true. If the symbol is not registered with any Resolver, then this returns false.


[View source]
def defineDataFile(symname : Symbol, filename : String | Path) #

Associates a data file named filename with a symbolic name for every one of the associated Resolver instances. The symbolic name must be unique for every Resolver.


[View source]
def defineDataFile!(symname : Symbol, filename : String | Path) #

Associates a data file named filename with a symbolic name for every one of the associated Resolver instances.

If the symbol is not unique to any of the Resolvers in this set, then the old path is forgotten for that Resolver and the symbol becomes associated with the new path.


[View source]
def delete(res : Resolver) : Resolver | Nil #

If the given Resolver exists in this set, it is removed from this set and returned. Otherwise, this returns nil.


[View source]
def delete_at(idx : Int) #

Deletes the given Resolver from the given index.


[View source]
def each(&) #

Loops over all of the Resolver instances in this set, yielding each one sequentially.


[View source]
def insert(idx : Int, res : Resolver) #

Inserts the given Resolver at the given index.


[View source]