lib/vedeu/repositories/repository.rb in vedeu-0.8.15 vs lib/vedeu/repositories/repository.rb in vedeu-0.8.16
- old
+ new
@@ -60,11 +60,11 @@
# Vedeu.cursors.by_name(:some_name)
#
# # Fetch the names of the interfaces belonging to this group.
# Vedeu.groups.by_name(name)
#
- # @param name [String|Symbol] The name of the stored model.
+ # @macro param_name
# @return [void]
def by_name(name = nil)
name = present?(name) ? name : Vedeu.focus
return find(name) if registered?(name)
@@ -79,20 +79,20 @@
find_or_create(Vedeu.focus) if Vedeu.focus
end
# Find the model by name.
#
- # @param name [String|Symbol]
+ # @macro param_name
# @return [Hash<String => Object>|NilClass]
def find(name)
storage[name]
end
# Find the model attributes by name, raises an exception when
# the model cannot be found.
#
- # @param name [String|Symbol]
+ # @macro param_name
# @raise [Vedeu::Error::ModelNotFound] When the model cannot be
# found with this name.
# @return [Hash<String => Object>]
def find!(name)
find(name) || raise(Vedeu::Error::ModelNotFound,
@@ -100,11 +100,11 @@
end
# Find a model by name, registers the model by name when not
# found.
#
- # @param name [String|Symbol]
+ # @macro param_name
# @return [void]
def find_or_create(name)
return find(name) if registered?(name)
Vedeu.log(type: :store,
@@ -120,11 +120,11 @@
end
# Returns a boolean indicating whether the named model is
# registered.
#
- # @param name [String|Symbol]
+ # @macro param_name
# @return [Boolean]
def registered?(name)
return false if absent?(name)
return false if empty?
@@ -132,10 +132,10 @@
end
# Returns the storage with the named model removed, or false
# when the model does not exist.
#
- # @param name [String|Symbol]
+ # @macro param_name
# @return [Hash|Boolean]
def remove(name)
return false if empty?
return false unless registered?(name)