Class/Module Index [+]

Quicksearch

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
def command_line
  Launchy::CommandLine.new
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
def log(msg)
  if ENV['LAUNCHY_DEBUG'] == 'true' then
    $stderr.puts "LAUNCHY_DEBUG: #{msg}"
  end
end
open(*params) click to toggle source

Convenience method to launch an item

# File lib/launchy.rb, line 21
def open(*params)
  begin
    klass = Launchy::Application.find_application_class_for(*params)
    if klass then
      klass.run(*params)
    else
      msg = "Unable to launch #{params.join(' ')}"
      Launchy.log "#{self.name} : #{msg}"
      $stderr.puts msg
    end
  rescue Exception => e
    msg = "Failure in opening #{params.join(' ')} : #{e}"
    Launchy.log "#{self.name} : #{msg}"
    $stderr.puts msg
  end
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
def self.require_all_libs_relative_to(fname)
  prepend   = File.basename(fname,".rb")
  search_me = File.join(File.dirname(fname),prepend)

  Dir.entries(search_me).each do |rb|
    if File.extname(rb) == ".rb" then
      require "#{prepend}/#{File.basename(rb,".rb")}"
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.