Class: Mascot::Extensions::PartialsRemover
- Inherits:
-
Object
- Object
- Mascot::Extensions::PartialsRemover
- Defined in:
- lib/mascot/extensions/partials_remover.rb
Overview
Removes files beginning with “_” from the resource collection.
Constant Summary collapse
- PARTIAL_PREFIX =
Partial rails prefix.
"_".freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.partial?(path) ⇒ Boolean
14 15 16 |
# File 'lib/mascot/extensions/partials_remover.rb', line 14 def self.partial?(path) File.basename(path).starts_with? PARTIAL_PREFIX end |
Instance Method Details
#process_resources(node) ⇒ Object
8 9 10 11 12 |
# File 'lib/mascot/extensions/partials_remover.rb', line 8 def process_resources(node) node.flatten.each do |r| r.node.remove if self.class.partial? r.asset.path # Looks like a smiley face, doesn't it? end end |