Class: QuickLook::Instance

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

Instance Method Summary collapse

Constructor Details

#initializeInstance

Returns a new instance of Instance.



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

def initialize
  @pid_map = {}
end

Instance Method Details

#close(path) ⇒ Object



28
29
30
31
32
# File 'lib/quick_look.rb', line 28

def close(path)
  if pid = pid_for(path)
    Process.kill("-HUP", pid)
  end
end

#open(path) ⇒ Object



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

def open(path)
  return if pid_for(path)
  add_pid path, Process.spawn("qlmanage -p #{path} >& /dev/null", pgroup: true)
end