class Datapack::Store

Defined in:

datapack.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def [](key : Path) #

Get a value indexed by the given path in the datapack. If the path is prefixed with a namespace:

namespace:/path/to/file.txt

The path will be searched for within that namespace. Otherwise, it will be searched for within the default namespace.


[View source]
def [](key : String) #

[View source]
def []=(key : Path, value) #

Set a value within the the datapack. As with getting a value, the path can be prefixed with a namespace, and if no namespace is provided, default will be used. The value to be stored must be an instance of Resource.


[View source]
def []=(key : String, value) #

[View source]
def find(key_fragment : Path) #

Return the Resource value for the first key which matches all of the elements of the key fragment. An exception will be raised if no key is found.


[View source]
def find(key_fragment : String) #

[View source]
def find?(key_fragment : Path) #

Return the Resource value for the first key which matches all of the elements of the key fragment. A nil will be returned if no key is found.


[View source]
def find?(key_fragment : String) #

[View source]
def find_all(key_fragment : Path) #

Return all of the Resource values for all keys which match all of the elements of the key fragment.


[View source]
def find_all(key_fragment : String) #

[View source]
def find_all_keys(key_fragment : Path) #

Find and return an array of all keys which match the key fragment provided as an argument. A key fragment is expressed as a path. Each of the elements of the path will be matched against an index of fragments, and all keys which contain all elements of the key fragment will be returned.


[View source]
def find_all_keys(key_fragment : String) #

[View source]
def find_key(key_fragment : Path) #

Find the first key which matches all of the elements of a key fragment. An exception will be raised if no key is found.


[View source]
def find_key(key_fragment : String) #

[View source]
def find_key?(key_fragment : Path) #

Find the first key which matches all of the elements of a key fragment. A nil will be returned if no key is found.


[View source]
def find_key?(key_fragment : String) #

[View source]
def index : SplayTreeMap(String, SplayTreeMap(String, Array(Path))) #

[View source]