Class: Spittle::Processor
- Inherits:
-
Object
- Object
- Spittle::Processor
- Defined in:
- lib/spittle/processor.rb
Instance Method Summary collapse
- #cleanup ⇒ Object
- #dir_processors ⇒ Object
- #directories ⇒ Object
-
#initialize(opts) ⇒ Processor
constructor
A new instance of Processor.
- #write ⇒ Object
Constructor Details
#initialize(opts) ⇒ Processor
Returns a new instance of Processor.
3 4 5 6 7 8 |
# File 'lib/spittle/processor.rb', line 3 def initialize(opts) @options = opts @processors = dir_processors @css_builder = StylesheetBuilder.new(@options[:source]) @css_builder.output_file(@options[:css_file] || @options[:source] + "/sprite.css") end |
Instance Method Details
#cleanup ⇒ Object
23 24 25 26 |
# File 'lib/spittle/processor.rb', line 23 def cleanup @processors.each{|d| d.cleanup} @css_builder.cleanup end |
#dir_processors ⇒ Object
19 20 21 |
# File 'lib/spittle/processor.rb', line 19 def dir_processors directories.map{|d| DirectoryProcessor.new(d, @options)} end |
#directories ⇒ Object
15 16 17 |
# File 'lib/spittle/processor.rb', line 15 def directories Dir.glob(@options[:source] + "/**/").map{|d| d.gsub(/\/$/, "")} end |
#write ⇒ Object
10 11 12 13 |
# File 'lib/spittle/processor.rb', line 10 def write @processors.each{|d| d.write} @css_builder.write end |