lib/scrivito/obj_collection.rb in scrivito_sdk-0.66.0 vs lib/scrivito/obj_collection.rb in scrivito_sdk-0.70.0.rc1

- old
+ new

@@ -1,57 +1,59 @@ module Scrivito - # This class allows you to retrieve Objects from a specific working copy. + # This class allows you to retrieve CMS objects from a specific working copy. # You can get an instance by accessing {Workspace#objs}. # @api public class ObjCollection attr_reader :workspace def initialize(workspace) @workspace = workspace end - # Find a {BasicObj Obj} by its id. - # If the parameter is an Array containing ids, return a list of corresponding Objs. + # Find an {BasicObj Obj} by its id. + # If the parameter is an Array containing ids, return a list of the + # corresponding {Scrivito::BasicObj Obj}s. # @param [String, Integer, Array<String, Integer>]id_or_list # @return [Obj, Array<Obj>] # @api public def find(id_or_list) find_using(id_or_list, :find_by) end # Find a {BasicObj Obj} by its id. - # If the parameter is an Array containing ids, return a list of corresponding Objs. - # The results include deleted objects as well. + # If the parameter is an Array containing ids, return a list of the + # corresponding {Scrivito::BasicObj Obj}s. The results include deleted objects as well. # @param [String, Integer, Array<String, Integer>]id_or_list # @return [Obj, Array<Obj>] # @api public def find_including_deleted(id_or_list) find_using(id_or_list, :find_by_including_deleted) end - # Find the {BasicObj Obj} with the given path. - # Returns +nil+ if no matching Obj exists. + # Find the {BasicObj Obj} that has the given path. + # Returns +nil+ if no matching object exists. # @param [String] path Path of the {BasicObj Obj}. # @return [Obj] # @api public def find_by_path(path) find_by(:path, [path]).first.first end - # Returns the {BasicObj Obj} with the given permalink, or +nil+ if no matching Obj exists. + # Returns the {BasicObj Obj} that has the given permalink, or +nil+ if no matching object exists. # @param [String] permalink The permalink of the {BasicObj Obj}. # @return [Obj] # @api public def find_by_permalink(permalink) find_by(:permalink, [permalink]).first.first end - # Returns a {ObjSearchEnumerator} with the given initial subquery consisting of the four arguments. + # Returns an {ObjSearchEnumerator} with the given initial subquery consisting of the four arguments. # - # Note that +field+ and +value+ can also be arrays for searching several fields or searching for several values. + # Note that +field+ and +value+ may also be arrays for searching several fields or searching for several values. # - # {ObjSearchEnumerator}s can be chained using one of the chainable methods (e.g. {ObjSearchEnumerator#and} and {ObjSearchEnumerator#and_not}). + # {ObjSearchEnumerator}s can be chained using one of the chainable methods + # (e.g. {ObjSearchEnumerator#and} and {ObjSearchEnumerator#and_not}). # # @param [Symbol, String, Array<Symbol, String>] field See {ObjSearchEnumerator#and} for details # @param [Symbol, String] operator See {ObjSearchEnumerator#and} for details # @param [String, Array<String>] value See {ObjSearchEnumerator#and} for details # @param [Hash] boost See {ObjSearchEnumerator#and} for details @@ -60,19 +62,19 @@ def where(field, operator, value, boost = nil) ObjSearchEnumerator.new(workspace) .and(field, operator, value, boost) end - # Returns a {ObjSearchEnumerator} of all {BasicObj Obj}s. + # Returns an {ObjSearchEnumerator} of all {BasicObj Obj}s. # @return [ObjSearchEnumerator] # @api public def all ObjSearchEnumerator.new(workspace).batch_size(1000) end - # Returns a {ObjSearchEnumerator} of all Objs with the given +obj_class+. - # @param [String] obj_class name of the obj class. + # Returns an {ObjSearchEnumerator} of all {BasicObj Obj}s with the given +obj_class+. + # @param [String] obj_class name of the object class. # @return [ObjSearchEnumerator] # @api public def find_all_by_obj_class(obj_class) all.and(:_obj_class, :equals, obj_class) end @@ -113,11 +115,11 @@ find_by_including_deleted(view, keys).map do |list| list.reject(&:deleted?) end end - # accepts the name of an "obj_by" - view, a list of keys - # returns a list of lists of Objs: a list of Objs for each given keys. + # Accepts the name of an "obj_by" view, a list of keys. + # Returns a list of lists of Objs: a list of Objs for each given key. def find_by_including_deleted(view, keys) result = CmsBackend.instance.find_obj_data_by( workspace.revision, view, keys)