Class: Vectory::InkscapeConverter

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/vectory/inkscape_converter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.convert(uri, output_extension, option) ⇒ Object



11
12
13
# File 'lib/vectory/inkscape_converter.rb', line 11

def self.convert(uri, output_extension, option)
  instance.convert(uri, output_extension, option)
end

Instance Method Details

#convert(uri, output_extension, option) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vectory/inkscape_converter.rb', line 15

def convert(uri, output_extension, option)
  exe = inkscape_path_or_raise_error
  uri = external_path uri
  exe = external_path exe
  cmd = %(#{exe} #{option} #{uri})

  call = SystemCall.new(cmd).call

  output_path = find_output(uri, output_extension)
  raise_conversion_error(call) unless output_path

  output_path
end

#height(content, format) ⇒ Object



29
30
31
# File 'lib/vectory/inkscape_converter.rb', line 29

def height(content, format)
  query_integer(content, format, "--query-height")
end

#width(content, format) ⇒ Object



33
34
35
# File 'lib/vectory/inkscape_converter.rb', line 33

def width(content, format)
  query_integer(content, format, "--query-width")
end