Module: Steam::Java

Extended by:
AutoDefine
Defined in:
lib/steam/java.rb

Defined Under Namespace

Modules: AutoDefine

Class Method Summary collapse

Methods included from AutoDefine

const_set_nested, pop_name

Class Method Details

.const_missing(name) ⇒ Object



30
31
32
33
# File 'lib/steam/java.rb', line 30

def const_missing(name)
  return init && const_get(name) unless @initialized
  super
end

.import(signature, name = nil) ⇒ Object



35
36
37
38
39
# File 'lib/steam/java.rb', line 35

def import(signature, name = nil)
  name ||= path_to_const_name(signature)
  name.gsub!('Java::', '')
  const_set_nested(name, Rjb::import(signature))
end

.initObject



45
46
47
48
49
50
51
52
53
54
# File 'lib/steam/java.rb', line 45

def init
  @initialized = true

  import('java.net.URL', 'Java::Net::Url')
  import('java.lang.System')
  import('java.util.Arrays')
  import('java.util.ArrayList')
  import('java.util.logging.Logger')
  import('java.util.logging.Level')
end

.load(paths) ⇒ Object



62
63
64
# File 'lib/steam/java.rb', line 62

def load(paths)
  Rjb::load(paths, Steam.config[:java_load_params].to_a)
end

.load_from(path) ⇒ Object



56
57
58
59
60
# File 'lib/steam/java.rb', line 56

def load_from(path)
  paths = Dir["#{Steam.config[:html_unit][:java_path]}/*.jar"]
  load(paths.join(':')) unless paths.empty?
  init
end

.log_level(name) ⇒ Object



70
71
72
# File 'lib/steam/java.rb', line 70

def log_level(name)
  Util::Logging::Level.send(name.to_s.upcase)
end

.logger(classifier) ⇒ Object



66
67
68
# File 'lib/steam/java.rb', line 66

def logger(classifier)
  Util::Logging::Logger.getLogger(classifier)
end

.path_to_const_name(path) ⇒ Object



41
42
43
# File 'lib/steam/java.rb', line 41

def path_to_const_name(path)
  path.split('.').map { |token| token.underscore.camelize }.join('::')
end