Module: Spotlight::PageContent

Defined in:
app/models/spotlight/page_content.rb,
app/models/spotlight/page_content/sir_trevor.rb

Overview

Factory for picking the right page content renderer

Defined Under Namespace

Classes: SirTrevor

Class Method Summary collapse

Class Method Details

.default_page_content_classObject



16
17
18
# File 'app/models/spotlight/page_content.rb', line 16

def self.default_page_content_class
  Spotlight::PageContent.const_get(Spotlight::Engine.config.default_page_content_type)
end

.for(page, attribute) ⇒ Object



8
9
10
11
12
13
14
# File 'app/models/spotlight/page_content.rb', line 8

def self.for(page, attribute)
  content_type = page.content_type
  content_class = Spotlight::PageContent.const_get(content_type) if Spotlight::PageContent.const_defined?(content_type)
  content_class ||= default_page_content_class

  content_class.parse(page, attribute)
end