Class: Restspec::Stores::NamespaceStoreDelegator
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Restspec::Stores::NamespaceStoreDelegator
- Defined in:
- lib/restspec/stores/namespace_store.rb
Overview
Provides methods for the NamespaceStore object.
Instance Method Summary collapse
-
#get(namespace_name) ⇒ Restspec::Endpoints::Namespace?
Get a namespace by name.
-
#store(namespace) ⇒ Object
Stores the namespace.
Instance Method Details
#get(namespace_name) ⇒ Restspec::Endpoints::Namespace?
Get a namespace by name. It gets the name as string or symbol.
23 24 25 |
# File 'lib/restspec/stores/namespace_store.rb', line 23 def get(namespace_name) fetch(namespace_name.to_s) { fetch(namespace_name.to_sym, nil) } end |
#store(namespace) ⇒ Object
Stores the namespace. It uses the namespace's name as the hash key.
11 12 13 14 15 16 17 |
# File 'lib/restspec/stores/namespace_store.rb', line 11 def store(namespace) if namespace.anonymous? raise "Can't add an anonymous namespace to the NamespaceStore" else self[namespace.name] = namespace end end |