Class: Naether::Java::JRuby

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/naether/java.rb

Overview

Handle loading jars for JRuby

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJRuby

Returns a new instance of JRuby.



85
86
87
88
89
# File 'lib/naether/java.rb', line 85

def initialize
  require 'java'
  
  @loaded_jars = []
end

Instance Attribute Details

#loaded_jarsObject (readonly)

Returns the value of attribute loaded_jars.



83
84
85
# File 'lib/naether/java.rb', line 83

def loaded_jars
  @loaded_jars
end

Instance Method Details

#load_jars(jars) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/naether/java.rb', line 91

def load_jars(jars)
  loaded_jars = []
  unless jars.is_a? Array
    jars = [jars]
  end
  
  jars.each do |jar|
    expanded_jar = File.expand_path(jar)
    if !@loaded_jars.include? expanded_jar
      require expanded_jar
      loaded_jars << expanded_jar
      @loaded_jars << expanded_jar
    end
  end
  
  loaded_jars
end