Class: Scrivito::ObjClassCollection Deprecated

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/scrivito/obj_class_collection.rb

Overview

Deprecated.

This class allows you to retrieve obj classes from a specific working copy. It behaves almost exactly as an Array, so methods like #each, #select etc. are available. You can get an instance by accessing Workspace#obj_classes.

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ ObjClass?

Deprecated.

Finds an obj class by its name in the working copy of the collection.

Examples:

Find the obj class named “Homepage” in the “rtc” Workspace.

Workspace.find('rtc').obj_classes['Homepage']

Parameters:

  • name (String)

    The name of the obj class.

Returns:

  • (ObjClass, nil)

    Returns the obj class or nil when no obj class with the given name can be found in the working copy.



29
30
31
32
33
# File 'lib/scrivito/obj_class_collection.rb', line 29

def [](name)
  if obj_class_data = CmsBackend.instance.find_obj_class_data_by_name(workspace.revision, name)
    ObjClass.new(obj_class_data, workspace)
  end
end

#each {|ObjClass| ... } ⇒ Object

Deprecated.

Yields successive obj classes of the collection. Implements the Enumerable interface.

Examples:

Find all obj classes in the “rtc” Workspace and print their name.

Workspace.find('rtc').obj_classes.each do |obj_class|
  puts obj_class.name
end

Yields:

See Also:



54
# File 'lib/scrivito/obj_class_collection.rb', line 54

delegate :each, to: :obj_classes