Class: Locomotive::Mounter::Reader::Api::ContentAssetsReader

Inherits:
Base
  • Object
show all
Defined in:
lib/locomotive/mounter/reader/api/content_assets_reader.rb

Instance Attribute Summary

Attributes inherited from Base

#items, #runner

Instance Method Summary collapse

Methods inherited from Base

#add_content_asset, #get, #initialize, #mounting_point

Constructor Details

This class inherits a constructor from Locomotive::Mounter::Reader::Api::Base

Instance Method Details

#readArray

Build the list of content assets from the public folder with eager loading.

Returns:

  • (Array)

    The cached list of theme assets



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/locomotive/mounter/reader/api/content_assets_reader.rb', line 12

def read
  super

  self.get(:content_assets).each do |attributes|
    url = attributes.delete('url')

    attributes['folder']  = 'samples/assets'
    attributes['uri']     = URI(url =~ /^https?:\/\// ? url : "#{self.base_uri_with_scheme}#{url}")

    self.items[url] = Locomotive::Mounter::Models::ContentAsset.new(attributes)
  end

  self.items
end