Class: Scrivito::ModelLibrary
- Inherits:
-
Object
- Object
- Scrivito::ModelLibrary
- Defined in:
- lib/scrivito/model_library.rb
Instance Method Summary collapse
-
#clear_cache ⇒ Object
Clears model cache.
-
#define(&block) ⇒ Object
Configures which models Scrivito assumes as pages and widgets.
-
#pages ⇒ Scrivito::ClassCollection
Lists available page models.
-
#paths ⇒ Array<String>
Lists available paths to scan for models.
-
#widgets ⇒ Scrivito::ClassCollection
Lists available widget models.
Instance Method Details
#clear_cache ⇒ Object
Clears model cache.
19 20 21 22 23 |
# File 'lib/scrivito/model_library.rb', line 19 def clear_cache @pages = nil @widgets = nil @paths = nil end |
#define(&block) ⇒ Object
Configures which models Scrivito assumes as pages and widgets.
31 32 33 |
# File 'lib/scrivito/model_library.rb', line 31 def define(&block) DSL.new(self).instance_eval(&block) end |
#pages ⇒ Scrivito::ClassCollection
Lists available page models.
42 43 44 |
# File 'lib/scrivito/model_library.rb', line 42 def pages @pages ||= load_models('page', Scrivito::BasicObj) end |
#paths ⇒ Array<String>
Lists available paths to scan for models.
64 65 66 |
# File 'lib/scrivito/model_library.rb', line 64 def paths @paths ||= (autoload_model_paths + custom_paths).map(&:to_s) end |
#widgets ⇒ Scrivito::ClassCollection
Lists available widget models.
53 54 55 |
# File 'lib/scrivito/model_library.rb', line 53 def @widgets ||= load_models('widget', Scrivito::BasicWidget) end |