Class: Vectory::Emf

Inherits:
Vector show all
Defined in:
lib/vectory/emf.rb

Instance Attribute Summary

Attributes inherited from Vector

#initial_path

Attributes inherited from Image

#content

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Vector

#convert_with_inkscape, #file_size, from_datauri, from_path, #height, #initialize, #mime, #path, #size, #to_uri, #width, #write

Methods inherited from Image

from_content, from_path, #initialize

Constructor Details

This class inherits a constructor from Vectory::Vector

Class Method Details

.all_mimetypesObject



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

def self.all_mimetypes
  [mimetype] + alternative_mimetypes
end

.alternative_mimetypesObject



19
20
21
# File 'lib/vectory/emf.rb', line 19

def self.alternative_mimetypes
  ["application/x-msmetafile"]
end

.default_extensionObject



7
8
9
# File 'lib/vectory/emf.rb', line 7

def self.default_extension
  "emf"
end

.from_node(node) ⇒ Object



23
24
25
26
27
28
# File 'lib/vectory/emf.rb', line 23

def self.from_node(node)
  uri = node["src"]
  return Vectory::Datauri.new(uri).to_vector if %r{^data:}.match?(uri)

  from_path(uri)
end

.mimetypeObject



15
16
17
# File 'lib/vectory/emf.rb', line 15

def self.mimetype
  "image/emf"
end

Instance Method Details

#to_epsObject



38
39
40
# File 'lib/vectory/emf.rb', line 38

def to_eps
  convert_with_inkscape("--export-type=eps", Eps)
end

#to_psObject



42
43
44
# File 'lib/vectory/emf.rb', line 42

def to_ps
  convert_with_inkscape("--export-type=ps", Ps)
end

#to_svgObject



30
31
32
33
34
35
36
# File 'lib/vectory/emf.rb', line 30

def to_svg
  with_file("emf") do |input_path|
    content = Emf2svg.from_file(input_path)

    Svg.from_content(content)
  end
end