Class: Kms::PageFetcher

Inherits:
Object
  • Object
show all
Defined in:
app/services/kms/page_fetcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ PageFetcher

Returns a new instance of PageFetcher.



3
4
5
# File 'app/services/kms/page_fetcher.rb', line 3

def initialize(path)
  @path = path
end

Instance Method Details

#fetch!Object



7
8
9
10
# File 'app/services/kms/page_fetcher.rb', line 7

def fetch!
  page = Page.published.find_by_fullpath(@path) || fetch_templatable_page! || fetch_404_page
  page ? page.to_drop : raise(ActiveRecord::RecordNotFound)
end