123456789_123456789_123456789_123456789_123456789_

Class: Sprockets::Exporters::FileExporter

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Base
Instance Chain:
self, Base
Inherits: Sprockets::Exporters::Base
Defined in: lib/sprockets/exporters/file_exporter.rb

Overview

Writes a an asset file to disk

Class Method Summary

Base - Inherited

.new

Public: Creates new instance.

Instance Attribute Summary

Instance Method Summary

Base - Inherited

#call

Public: Contains logic for writing “exporting” asset to disk.

#setup

Public: Callback that is executed after initialization.

#skip?

Public: Handles logic for skipping exporter and notifying logger.

#write

Public: Yields a file that can be written to with the input.

Constructor Details

This class inherits a constructor from Sprockets::Exporters::Base

Instance Method Details

#call

[ GitHub ]

  
# File 'lib/sprockets/exporters/file_exporter.rb', line 17

def call
  write(target) do |file|
    file.write(asset.source)
  end
end

#skip?(logger) ⇒ Boolean

[ GitHub ]

  
# File 'lib/sprockets/exporters/file_exporter.rb', line 7

def skip?(logger)
  if ::File.exist?(target)
    logger.debug "Skipping #{ target }, already exists"
    true
  else
    logger.info "Writing #{ target }"
    false
  end
end