Class: Locomotive::Mounter::Reader::Api::ThemeAssetsReader
- Defined in:
- lib/locomotive/mounter/reader/api/theme_assets_reader.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(runner) ⇒ ThemeAssetsReader
constructor
A new instance of ThemeAssetsReader.
-
#read ⇒ Array
Build the list of theme assets from the public folder with eager loading.
Methods inherited from Base
#add_content_asset, #get, #mounting_point
Constructor Details
#initialize(runner) ⇒ ThemeAssetsReader
Returns a new instance of ThemeAssetsReader.
8 9 10 11 |
# File 'lib/locomotive/mounter/reader/api/theme_assets_reader.rb', line 8 def initialize(runner) super self.items = [] end |
Instance Method Details
#read ⇒ Array
Build the list of theme assets from the public folder with eager loading.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/locomotive/mounter/reader/api/theme_assets_reader.rb', line 17 def read super self.items = self.get(:theme_assets).map do |attributes| url = attributes.delete('url') url.gsub!(/^\/\//, "https://") attributes['uri'] = URI(url =~ /^https?:\/\// ? url : "#{self.base_uri_with_scheme}#{url}") Locomotive::Mounter::Models::ThemeAsset.new(attributes) end end |