Class: Luca::AssetCompiler
- Inherits:
-
Object
- Object
- Luca::AssetCompiler
- Defined in:
- lib/luca/asset_compiler.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#input ⇒ Object
Returns the value of attribute input.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #compiled ⇒ Object
- #filename ⇒ Object
-
#initialize(options = {}) ⇒ AssetCompiler
constructor
A new instance of AssetCompiler.
- #output ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ AssetCompiler
Returns a new instance of AssetCompiler.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/luca/asset_compiler.rb', line 5 def initialize(={}) @input = [:input] @type = [:type] @name = [:name] @file = [:file] if file @name ||= File.basename(file).split('.').first @input ||= IO.read(file) end end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
3 4 5 |
# File 'lib/luca/asset_compiler.rb', line 3 def file @file end |
#input ⇒ Object
Returns the value of attribute input.
3 4 5 |
# File 'lib/luca/asset_compiler.rb', line 3 def input @input end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/luca/asset_compiler.rb', line 3 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/luca/asset_compiler.rb', line 3 def type @type end |
Instance Method Details
#compiled ⇒ Object
22 23 24 |
# File 'lib/luca/asset_compiler.rb', line 22 def compiled compile_file_using_sprockets rescue compile_file_manually end |
#filename ⇒ Object
26 27 28 |
# File 'lib/luca/asset_compiler.rb', line 26 def filename @filename ||= "#{ rand(36**16).to_s(36).slice(0,8) }__#{ name }#{ extension }" end |
#output ⇒ Object
18 19 20 |
# File 'lib/luca/asset_compiler.rb', line 18 def output @output ||= compiled end |