Class: Scrivito::ModelLibrary

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

Instance Method Summary collapse

Instance Method Details

#clear_cacheObject

Clears model cache.

See Also:



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.

See Also:



31
32
33
# File 'lib/scrivito/model_library.rb', line 31

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

#pagesScrivito::ClassCollection

Lists available page models.

Returns:

See Also:



42
43
44
# File 'lib/scrivito/model_library.rb', line 42

def pages
  @pages ||= load_models('page', Scrivito::BasicObj)
end

#pathsArray<String>

Lists available paths to scan for models.

Returns:

  • (Array<String>)

    available paths to scan for models.

See Also:



64
65
66
# File 'lib/scrivito/model_library.rb', line 64

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

#widgetsScrivito::ClassCollection

Lists available widget models.

Returns:

See Also:



53
54
55
# File 'lib/scrivito/model_library.rb', line 53

def widgets
  @widgets ||= load_models('widget', Scrivito::BasicWidget)
end