class BSON::Document
def fetch(key, *args, &block)
- Since: - 4.4.0
Returns:
-
(Object)
- The found value. Raises KeyError if none found.
Other tags:
- Yield: - Block returning default value for the given key.
Parameters:
-
default
(Object
) -- Returned value if key does not exist. -
key
(String, Symbol
) -- The key to look up.
Other tags:
- Example: Get an element for the key by symbol with a block default. -
Example: Get an element for the key by symbol with a default. -
Example: Get an element for the key. -
Overloads:
-
fetch(key, &block)
-
fetch(key, default)
-
fetch(key)
def fetch(key, *args, &block) key = convert_key(key) super(key, *args, &block) end