Class: Assets::Rule::Compile
- Inherits:
-
Assets::Rule
- Object
- Assets::Rule
- Assets::Rule::Compile
- Defined in:
- lib/assets/rule/compile.rb,
lib/assets/rule/compile/css.rb,
lib/assets/rule/compile/javascript.rb,
lib/assets/rule/compile/javascript/coffescript.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Css, Javascript
Class Method Summary collapse
-
.build(rule) ⇒ Rule::Compile
private
Build compiler rule.
-
.mime ⇒ Mime
private
Return mime type.
-
.registry ⇒ Hash
private
Return registry.
Instance Method Summary collapse
-
#mime ⇒ Mime
private
Return mime type.
-
#name ⇒ String
private
Return name.
-
#target_name ⇒ String
private
Return target name.
-
#updated_at ⇒ Time
private
Return updated at.
Methods inherited from Assets::Rule
#asset, #body, #fresh_at?, #rename
Class Method Details
.build(rule) ⇒ Rule::Compile
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build compiler rule
72 73 74 75 76 |
# File 'lib/assets/rule/compile.rb', line 72 def self.build(rule) builder = Compile.registry.fetch(rule.mime) compiler = builder.new(rule) Rename.new(compiler.target_name, compiler) end |
.mime ⇒ Mime
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return mime type
94 95 96 |
# File 'lib/assets/rule/compile.rb', line 94 def self.mime self::MIME end |
.registry ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return registry
44 45 46 |
# File 'lib/assets/rule/compile.rb', line 44 def self.registry @registry ||= {} end |
Instance Method Details
#mime ⇒ Mime
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return mime type
84 85 86 |
# File 'lib/assets/rule/compile.rb', line 84 def mime self.class.mime end |
#name ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return name
12 13 14 |
# File 'lib/assets/rule/compile.rb', line 12 def name input.name end |
#target_name ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return target name
32 33 34 35 |
# File 'lib/assets/rule/compile.rb', line 32 def target_name regexp = %r(#{Regexp.escape(input.extname)}\z) name.gsub(regexp, mime.extname) end |
#updated_at ⇒ Time
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return updated at
22 23 24 |
# File 'lib/assets/rule/compile.rb', line 22 def updated_at input.updated_at end |