Class: CodeSync::TempAsset
- Inherits:
-
Sprockets::BundledAsset
- Object
- Sprockets::BundledAsset
- CodeSync::TempAsset
- Defined in:
- lib/code_sync/temp_asset.rb
Class Method Summary collapse
Class Method Details
.create_from(content, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/code_sync/temp_asset.rb', line 5 def self.create_from content, ={} environment, filename, extension = .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 |