Class: Assette::PostProcessor::Base
- Inherits:
-
Object
- Object
- Assette::PostProcessor::Base
- Defined in:
- lib/assette/post_processor.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file, str = nil, args = {}) ⇒ Base
constructor
A new instance of Base.
- #process ⇒ Object
- #processor ⇒ Object
- #should_process? ⇒ Boolean
Constructor Details
#initialize(file, str = nil, args = {}) ⇒ Base
Returns a new instance of Base.
12 13 14 15 |
# File 'lib/assette/post_processor.rb', line 12 def initialize(file, str=nil, args={}) @file = file @str = str||file.code; @args = args end |
Class Method Details
.inherited(subclass) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/assette/post_processor.rb', line 32 def inherited subclass return if subclass == Assette::PostProcessor::Base || subclass.inspect =~ /#<Class/ if outputs Assette::PostProcessor::POST_PROCESSORS[outputs] |= [subclass] end end |
.outputs ⇒ Object
40 41 42 |
# File 'lib/assette/post_processor.rb', line 40 def outputs end |
.set_outputs(val) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/assette/post_processor.rb', line 44 def set_outputs val raise ArgumentError, 'must set outputs to a symbol' unless val.is_a?(Symbol) instance_eval <<-RUBY def outputs #{val.inspect} end RUBY val end |
Instance Method Details
#process ⇒ Object
25 26 27 28 29 |
# File 'lib/assette/post_processor.rb', line 25 def process return @str unless should_process? processor end |
#processor ⇒ Object
21 22 23 |
# File 'lib/assette/post_processor.rb', line 21 def processor raise Exception, "You must implement the processor method for #{self.class.inspect} (you can use the @str)" end |
#should_process? ⇒ Boolean
17 18 19 |
# File 'lib/assette/post_processor.rb', line 17 def should_process? true end |