class Datapack::Store

Defined in:

datapack.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

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.


def [](key : String) #

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.


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

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.


def find(key_fragment : String) #

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.


def find?(key_fragment : String) #

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.


def find_all(key_fragment : String) #

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.


def find_all_keys(key_fragment : String) #

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.


def find_key(key_fragment : String) #

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.


def find_key?(key_fragment : String) #

def index : SplayTreeMap(String, SplayTreeMap(String, Array(Path))) #