Class: Scrivito::ModelLibrary
- Inherits:
 - 
      Object
      
        
- Object
 - Scrivito::ModelLibrary
 
 
- Defined in:
 - app/cms/scrivito/model_library.rb
 
Instance Method Summary collapse
- 
  
    
      #clear_cache  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Clears model cache.
 - 
  
    
      #define(&block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Configures which models Scrivito assumes as pages, widgets and objs.
 - 
  
    
      #objs  ⇒ Scrivito::ClassCollection 
    
    
  
  
  
  
  
  
  
  
  
    
Lists available CMS object models.
 - 
  
    
      #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.
      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.
      36 37 38  | 
    
      # File 'app/cms/scrivito/model_library.rb', line 36 def define(&block) DSL.new(self).instance_eval(&block) end  | 
  
#objs ⇒ Scrivito::ClassCollection
Lists available CMS object models.
      69 70 71  | 
    
      # File 'app/cms/scrivito/model_library.rb', line 69 def objs @objs ||= build_class_collection { BasicObj.descendants.select(&:name) } end  | 
  
#pages ⇒ Scrivito::ClassCollection
Lists available page models.
      47 48 49  | 
    
      # File 'app/cms/scrivito/model_library.rb', line 47 def pages @pages ||= build_class_collection { valid_page_classes } end  | 
  
#paths ⇒ Array<String>
Lists available paths to scan for models.
      80 81 82  | 
    
      # File 'app/cms/scrivito/model_library.rb', line 80 def paths @paths ||= (autoload_model_paths + custom_paths).map(&:to_s) end  | 
  
#widgets ⇒ Scrivito::ClassCollection
Lists available widget models.
      58 59 60  | 
    
      # File 'app/cms/scrivito/model_library.rb', line 58 def @widgets ||= build_class_collection { } end  |