class Restspec::Stores::NamespaceStoreDelegator

Provides methods for the {NamespaceStore} object.

Public Instance Methods

get(namespace_name) click to toggle source

Get a namespace by name. It gets the name as string or symbol.

@param namespace_name [String, Symbol] the namespace's name to use for search. @return [Restspec::Endpoints::Namespace, nil] the namespace found.

# 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) click to toggle source

Stores the namespace. It uses the namespace's name as the hash key.

@param namespace [Restspec::Endpoints::Namespace] the namespace to store. @raise [StandardError] if the namespace is an anonymous one.

# 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