Module: RjbLoader

Defined in:
lib/rjb-loader.rb,
lib/rjb-loader/version.rb

Defined Under Namespace

Classes: Config, Railtie

Constant Summary collapse

VERSION =
"0.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.after_load_blocksObject

Returns the value of attribute after_load_blocks.



36
37
38
# File 'lib/rjb-loader.rb', line 36

def after_load_blocks
  @after_load_blocks
end

.before_load_blocksObject

Returns the value of attribute before_load_blocks.



35
36
37
# File 'lib/rjb-loader.rb', line 35

def before_load_blocks
  @before_load_blocks
end

.configObject

Returns the value of attribute config.



37
38
39
# File 'lib/rjb-loader.rb', line 37

def config
  @config
end

Class Method Details

.after_load(&block) ⇒ Object



50
51
52
# File 'lib/rjb-loader.rb', line 50

def self.after_load &block
  self.after_load_blocks << block 
end

.before_load(&block) ⇒ Object



46
47
48
# File 'lib/rjb-loader.rb', line 46

def self.before_load &block
  self.before_load_blocks << block 
end

.initObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/rjb-loader.rb', line 54

def self.init    
  before_load_blocks.each do |block|
    block.call(config)
  end

  if Rjb.loaded?
    ::Rails.logger.error "Rjb already loaded! RjbLoader configuration options like 'config.classpath' and 'config.java_options' will not apply."
  else
    Rjb::load( config.classpath, config.java_options )
  end
  
  after_load_blocks.each do |block|
    block.call(config)
  end
end