Class: Processing::Launcher
- Inherits:
-
Object
- Object
- Processing::Launcher
- Defined in:
- lib/jruby_art/launcher.rb
Overview
The command class check for configuration and options, before creating and executing the jruby (or java) command to run the sketch
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
-
#cmd ⇒ Object
Trade in this Ruby instance for a JRuby instance, loading in a starter script and passing it some arguments.
-
#initialize(runner:, args:, filename:) ⇒ Launcher
constructor
A new instance of Launcher.
Constructor Details
#initialize(runner:, args:, filename:) ⇒ Launcher
Returns a new instance of Launcher.
10 11 12 13 14 15 16 |
# File 'lib/jruby_art/launcher.rb', line 10 def initialize(runner:, args:, filename:) @command = if Processing::RP_CONFIG.fetch('JRUBY', true) JRubyCommand.new(runner, filename, args) else JavaCommand.new(runner, filename, args) end end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
9 10 11 |
# File 'lib/jruby_art/launcher.rb', line 9 def command @command end |
Instance Method Details
#cmd ⇒ Object
Trade in this Ruby instance for a JRuby instance, loading in a starter script and passing it some arguments. Unless you set JRUBY: false in ~/.jruby_art/config.yml, an installed version of jruby is used instead of our vendored one. Note the use of jruby-complete might make using other gems in your sketches hard (but not impossible).…
23 24 25 26 27 28 29 30 |
# File 'lib/jruby_art/launcher.rb', line 23 def cmd cmda = command.cmd begin exec(*cmda) # exec replaces the Ruby process with the JRuby one. rescue Java::JavaLang::ClassNotFoundException end end |