Class: Batik::Rasterizer
- Inherits:
-
Object
- Object
- Batik::Rasterizer
- Defined in:
- lib/batik/rasterizer.rb
Defined Under Namespace
Classes: RuntimeException
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#command_options ⇒ Object
private.
-
#initialize(options = {}) ⇒ Rasterizer
constructor
A new instance of Rasterizer.
- #path_to_jar_file ⇒ Object
- #path_to_java ⇒ Object
- #rasterize(file) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Rasterizer
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/batik/rasterizer.rb', line 9 def initialize( = {}) = @command = [ path_to_java, '-Djava.awt.headless=true', '-jar', path_to_jar_file, ] end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
7 8 9 |
# File 'lib/batik/rasterizer.rb', line 7 def command @command end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/batik/rasterizer.rb', line 7 def end |
Instance Method Details
#command_options ⇒ Object
private
27 28 29 |
# File 'lib/batik/rasterizer.rb', line 27 def .map {|name, argument| "-#{name} #{argument}"} end |
#path_to_jar_file ⇒ Object
35 36 37 38 |
# File 'lib/batik/rasterizer.rb', line 35 def path_to_jar_file .delete(:jar_file) || File.join(File.dirname(__FILE__), *%w".. .. vendor batik-1.7 batik-rasterizer.jar") end |
#path_to_java ⇒ Object
31 32 33 |
# File 'lib/batik/rasterizer.rb', line 31 def path_to_java .delete(:java) || "java" end |
#rasterize(file) ⇒ Object
20 21 22 23 |
# File 'lib/batik/rasterizer.rb', line 20 def rasterize(file) command << file Open3.popen3(command.join(' ')){|_,_,err| err.read.empty? } end |