module Novika::IDict

Overview

Novika dictionary protocol. Objects or values that want to be Block dictionaries can implement this protocol to make that possible.

Direct including types

Defined in:

novika/dict.cr

Instance Method Summary

Instance Method Detail

abstract def clear #

Removes all entries in this dictionary.


[View source]
abstract def copy : IDict #

Returns a shallow copy of this dictionary.


[View source]
abstract def count : Int32 #

Returns the amount of entries in this dictionary.


[View source]
abstract def del(name : Form) #

Deletes the entry corresponding to name form in this dictionary if it exists. Otherwise, does nothing.


[View source]
abstract def each(& : Form, Form -> ) #

Yields key, value forms in this dictionary.


[View source]
def empty? : Bool #

Returns whether this dictionary currently stores no entries.


[View source]
abstract def get(name : Form, & : Form -> Entry | Nil) : Entry | Nil #

Returns the entry corresponding to name form in this dictionary, or yields with name and returns the block result.


[View source]
abstract def has?(name : Form) : Bool #

Returns whether this dictionary has an entry corresponding to name form.


[View source]
abstract def import!(donor : IDict) #

Imports entries from donor dictionary into this dictionary.

Entries whose names are preceded by one or more _ are not imported (they are considered private).


[View source]
abstract def set(name : Form, entry : Entry) : Entry #

Assigns name form to entry in this dictionary.


[View source]
abstract def to_dict : Dict #

Converts this dictionary to the standard Dict implementation (used in e.g. serialization).


[View source]