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



14
15
16
# File 'app/models/spotlight/page_content.rb', line 14

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

.for(page, attribute) ⇒ Object



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

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