Parent

Launchy::Application

Application is the base class of all the application types that launchy may invoke. It essentially defines the public api of the launchy system.

Every class that inherits from Application must define:

  1. A constructor taking no parameters

  2. An instance method ‘open’ taking a string or URI as the first parameter and a hash as the second

  3. A class method ‘handles?’ that takes a String and returns true if that class can handle the input.

Attributes

host_os_family[R]
ruby_engine[R]
runner[R]

Public Class Methods

find_executable( bin, *paths ) click to toggle source

Find the given executable in the available paths

    # File lib/launchy/application.rb, line 29
29:       def find_executable( bin, *paths )
30:         paths = ENV['PATH'].split( File::PATH_SEPARATOR ) if paths.empty?
31:         paths.each do |path|
32:           file = File.join( path, bin )
33:           if File.executable?( file ) then
34:             Launchy.log "#{self.name} : found executable #{file}"
35:             return file
36:           end
37:         end
38:         Launchy.log "#{self.name} : Unable to find `#{bin}' in #{paths.join(", ")}"
39:         return nil
40:       end
handling( uri ) click to toggle source

Find the application that handles the given uri.

returns the Class that can handle the uri

    # File lib/launchy/application.rb, line 21
21:       def handling( uri )
22:         klass = find_child( :handles?, uri )
23:         return klass if klass
24:         raise ApplicationNotFoundError, "No application found to handle '#{uri}'"
25:       end
new() click to toggle source
    # File lib/launchy/application.rb, line 47
47:     def initialize
48:       @host_os_family = Launchy::Detect::HostOsFamily.detect
49:       @ruby_engine    = Launchy::Detect::RubyEngine.detect
50:       @runner         = Launchy::Detect::Runner.detect
51:     end

Public Instance Methods

find_executable( bin, *paths ) click to toggle source
    # File lib/launchy/application.rb, line 53
53:     def find_executable( bin, *paths )
54:       Application.find_executable( bin, *paths )
55:     end
run( cmd, *args ) click to toggle source
    # File lib/launchy/application.rb, line 57
57:     def run( cmd, *args )
58:       runner.run( cmd, *args )
59:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.