Class: Scrivito::ModelLibrary

Inherits:
Object
  • Object
show all
Defined in:
app/cms/scrivito/model_library.rb

Instance Method Summary collapse

Instance Method Details

#clear_cacheObject

Clears model cache.

See Also:



22
23
24
25
26
27
28
# File 'app/cms/scrivito/model_library.rb', line 22

def clear_cache
  @pages                = nil
  @widgets              = nil
  @objs                 = nil
  @paths                = nil
  @require_dependencies = nil
end

#define(&block) ⇒ Object

Configures which models Scrivito assumes as pages, widgets and objs.

See Also:



36
37
38
# File 'app/cms/scrivito/model_library.rb', line 36

def define(&block)
  DSL.new(self).instance_eval(&block)
end

#objsScrivito::ClassCollection

Lists available CMS object models.

Returns:

See Also:



69
70
71
# File 'app/cms/scrivito/model_library.rb', line 69

def objs
  @objs ||= build_class_collection { BasicObj.descendants.select(&:name) }
end

#pagesScrivito::ClassCollection

Lists available page models.

Returns:

See Also:



47
48
49
# File 'app/cms/scrivito/model_library.rb', line 47

def pages
  @pages ||= build_class_collection { valid_page_classes }
end

#pathsArray<String>

Lists available paths to scan for models.

Returns:

  • (Array<String>)

    available paths to scan for models.

See Also:



80
81
82
# File 'app/cms/scrivito/model_library.rb', line 80

def paths
  @paths ||= (autoload_model_paths + custom_paths).map(&:to_s)
end

#widgetsScrivito::ClassCollection

Lists available widget models.

Returns:

See Also:



58
59
60
# File 'app/cms/scrivito/model_library.rb', line 58

def widgets
  @widgets ||= build_class_collection { valid_widget_classes }
end