Launchy

Constants

VERSION

Public Class Methods

command_line() click to toggle source

Create an instance of the commandline application of launchy

    # File lib/launchy.rb, line 47
47:     def command_line
48:       Launchy::CommandLine.new
49:     end
log(msg) click to toggle source

Setting the LAUNCHY_DEBUG environment variable to ‘true’ will spew debug information to $stderr

    # File lib/launchy.rb, line 40
40:     def log(msg)
41:       if ENV['LAUNCHY_DEBUG'] == 'true' then
42:         $stderr.puts "LAUNCHY_DEBUG: #{msg}"
43:       end
44:     end
open(*params) click to toggle source

Convenience method to launch an item

    # File lib/launchy.rb, line 21
21:     def open(*params)
22:       begin
23:         klass = Launchy::Application.find_application_class_for(*params)
24:         if klass then
25:           klass.run(*params)
26:         else
27:           msg = "Unable to launch #{params.join(' ')}"
28:           Launchy.log "#{self.name} : #{msg}"
29:           $stderr.puts msg
30:         end
31:       rescue Exception => e
32:         msg = "Failure in opening #{params.join(' ')} : #{e}"
33:         Launchy.log "#{self.name} : #{msg}"
34:         $stderr.puts msg
35:       end
36:     end
require_all_libs_relative_to(fname) click to toggle source

Utility method to require all files ending in .rb in the directory with the same name as this file minus .rb

    # File lib/launchy.rb, line 6
 6:   def self.require_all_libs_relative_to(fname)
 7:     prepend   = File.basename(fname,".rb")
 8:     search_me = File.join(File.dirname(fname),prepend)
 9: 
10:     Dir.entries(search_me).each do |rb|
11:       if File.extname(rb) == ".rb" then
12:         require "#{prepend}/#{File.basename(rb,".rb")}"
13:       end
14:     end
15:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.