Method: Spotlight::PageContent.for

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

.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