Sha256: 5527f7017e62647b55c6e8386b4aabe8e8a40215635bee6ecb461cd0c93e8b35

Contents?: true

Size: 535 Bytes

Versions: 1

Compression:

Stored size: 535 Bytes

Contents

require 'sprockets'

module CodeSync
  class TempAsset < Sprockets::BundledAsset
    def self.create_from content, options={}
      environment, filename, extension = options.values_at(:env, :filename, :extension)

      filename    = filename || "compiled"

      tempfile        = Tempfile.new([filename, extension])

      tempfile.write(content) && tempfile.rewind

      pathname        = Pathname.new(tempfile.path)
      logical_path    = File.basename(pathname)

      new(environment, logical_path, pathname)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
code_sync-0.6.7 lib/code_sync/temp_asset.rb