Class: QuickLook::Instance
- Inherits:
-
Object
- Object
- QuickLook::Instance
- Defined in:
- lib/quick_look.rb
Instance Method Summary collapse
- #close(path) ⇒ Object
-
#initialize ⇒ Instance
constructor
A new instance of Instance.
- #open(path) ⇒ Object
Constructor Details
#initialize ⇒ Instance
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 |