Class: Spittle::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/spittle/processor.rb

Instance Method Summary collapse

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

#cleanupObject



23
24
25
26
# File 'lib/spittle/processor.rb', line 23

def cleanup
  @processors.each{|d| d.cleanup}
  @css_builder.cleanup
end

#dir_processorsObject



19
20
21
# File 'lib/spittle/processor.rb', line 19

def dir_processors
  directories.map{|d| DirectoryProcessor.new(d, @options)}
end

#directoriesObject



15
16
17
# File 'lib/spittle/processor.rb', line 15

def directories
  Dir.glob(@options[:source] + "/**/").map{|d| d.gsub(/\/$/, "")}
end

#writeObject



10
11
12
13
# File 'lib/spittle/processor.rb', line 10

def write
  @processors.each{|d| d.write}
  @css_builder.write
end