Class: Propaganda::Fop::Bridge

Inherits:
Object
  • Object
show all
Defined in:
lib/propaganda/fop/bridge.rb

Instance Method Summary collapse

Constructor Details

#initialize(verbose = false) ⇒ Bridge

Returns a new instance of Bridge.



6
7
8
# File 'lib/propaganda/fop/bridge.rb', line 6

def initialize(verbose=false)
  @verbose = verbose
end

Instance Method Details

#invoke(*args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/propaganda/fop/bridge.rb', line 10

def invoke(*args)
  # When invoking we need to use our own Manager class because the default
  # cli Main class deletes the file on exit and always calls System.exit 
  # which closes our application. We avoid that and also setup additional
  # protection against rogue System.exit calls in the library
  SystemExitManager.disableSystemExitCall
  Manager._invoke('main', '[Ljava.lang.String;', args)
  Output.toString
rescue Exception => e
  raise "Could not render document [#{e}] (" + Errors.toString + ")"
ensure  
  SystemExitManager.enableSystemExitCall
end