class Sasquatch::Quatcher
Attributes
compiler[R]
listeners[R]
options[R]
Public Class Methods
new(*args)
click to toggle source
# File lib/quatch/quatcher.rb, line 13 def initialize *args @options = parse_options args @listeners = [] @compiler = Compiler.new('.min.js') @options[:files].each do |file| @listeners << Listener.new(file, &file_changed) end end
Public Instance Methods
file_changed()
click to toggle source
# File lib/quatch/quatcher.rb, line 29 def file_changed Proc.new do |modified_file, file, files| @compiler.compile(files, file) logger "Sasquatch has detected a change to #{modified_file}, recompiling..." end end
parse_options(argv)
click to toggle source
# File lib/quatch/quatcher.rb, line 39 def parse_options(argv) params = {} parser = OptionParser.new parser.on("-n") { params[:line_numbering_style] ||= :all_lines } parser.on("-b") { params[:line_numbering_style] = :significant_lines } parser.on("-s") { params[:squeeze_extra_newlines] = true } params[:files] = parser.parse(argv) params end