Class: Guard::Imageoptim

Inherits:
Plugin
  • Object
show all
Defined in:
lib/guard/imageoptim.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Imageoptim

Returns a new instance of Imageoptim.



7
8
9
10
# File 'lib/guard/imageoptim.rb', line 7

def initialize(options = {})
  super
  @watchdir = options[:watchdir] || Dir.pwd
end

Instance Method Details

#do_it(paths) ⇒ Object



20
21
22
23
24
25
# File 'lib/guard/imageoptim.rb', line 20

def do_it(paths)
  paths.each do |path|
    file = File.join(@watchdir, path)
    puts `echo #{file} | imageOptim --quit` 
  end
end

#run_on_additions(paths) ⇒ Object



16
17
18
# File 'lib/guard/imageoptim.rb', line 16

def run_on_additions(paths)
  do_it(paths)
end

#run_on_modifications(paths) ⇒ Object



12
13
14
# File 'lib/guard/imageoptim.rb', line 12

def run_on_modifications(paths)
  do_it(paths)
end