class Launchy::Detect::RubyEngine - launchy-2.4.3 Documentation

# class Launchy::Detect::RubyEngine

### Attributes

ruby_engine[R]
to_s[R]

### Public Class Methods

detect( ruby_engine = RubyEngine.new ) click to toggle source

Detect the current ruby engine.

If the current ruby engine cannot be detected, the return RubyEngine::Unknown

    # File lib/launchy/detect/ruby_engine.rb, line 11
    def self.detect( ruby_engine = RubyEngine.new )
      found = find_child( :is_current_engine?, ruby_engine.to_s )
      return found if found
      raise NotFoundError, "#{ruby_engine_error_message( ruby_engine )} #{Launchy.bug_report_message}"
    end

is_current_engine?( ruby_engine ) click to toggle source

    # File lib/launchy/detect/ruby_engine.rb, line 29
    def self.is_current_engine?( ruby_engine )
      return ruby_engine == self.engine_name
    end

jruby?() click to toggle source

    # File lib/launchy/detect/ruby_engine.rb, line 34
    def self.jruby?()   self == Jruby;   end

macruby?() click to toggle source

    # File lib/launchy/detect/ruby_engine.rb, line 36
    def self.macruby?() self == MacRuby; end

mri?() click to toggle source

    # File lib/launchy/detect/ruby_engine.rb, line 33
    def self.mri?()     self == Mri;     end

new( ruby_engine = Launchy.ruby_engine ) click to toggle source

    # File lib/launchy/detect/ruby_engine.rb, line 40
    def initialize( ruby_engine = Launchy.ruby_engine )
      if ruby_engine then
        @ruby_engine = ruby_engine
      else
        @ruby_engine = defined?( RUBY_ENGINE ) ? RUBY_ENGINE : "ruby"
      end
    end

rbx?() click to toggle source

    # File lib/launchy/detect/ruby_engine.rb, line 35
    def self.rbx?()     self == Rbx;     end

ruby_engine_error_message( ruby_engine ) click to toggle source

    # File lib/launchy/detect/ruby_engine.rb, line 17
    def self.ruby_engine_error_message( ruby_engine )
      msg = "Unkonwn RUBY_ENGINE "
      if ruby_engine then
        msg += " '#{ruby_engine}'."
      elsif defined?( RUBY_ENGINE ) then
        msg += " '#{RUBY_ENGINE}'."
      else
        msg = "RUBY_ENGINE not defined for #{RUBY_DESCRIPTION}."
      end
      return msg
    end