module ScreenshotOpener

Constants

VERSION

Public Instance Methods

open_image() click to toggle source
# File lib/screenshot_opener.rb, line 13
def open_image
  system("#{open_command} #{image_path}") if open_command
end
take_screenshot() click to toggle source
Calls superclass method
# File lib/screenshot_opener.rb, line 8
def take_screenshot
  super
  open_image
end

Private Instance Methods

cmd_exists?(cmd) click to toggle source
# File lib/screenshot_opener.rb, line 28
def cmd_exists?(cmd)
  system("type '#{cmd}'", out: File::NULL, err: File::NULL)
  $?.exitstatus == 0
end
open_command() click to toggle source
# File lib/screenshot_opener.rb, line 18
def open_command
  @open_command ||= begin
    if self.command
      self.command
    else
      %w(xdg-open gnome-open open).detect { |cmd| cmd_exists?(cmd) }
    end
  end
end