Module: OBF::UnknownFile

Defined in:
lib/obf/unknown_file.rb

Class Method Summary collapse

Class Method Details

.to_external(path) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/obf/unknown_file.rb', line 2

def self.to_external(path)
  type = OBF::Utils.identify_file(path)
  if type == :obf
    OBF::OBF.to_external(path, {})
  elsif type == :obz
    OBF::OBZ.to_external(path, {})
  elsif type == :avz
    OBF::Avz.to_external(path)
  elsif type == :picto4me
    OBF::Picto4me.to_external(path)
  elsif type == :sfy
    OBF::Sfy.to_external(path)
  elsif type == :sgrid
    OBF::Sgrid.to_external(path)
  else
    raise "unrecognized file type"
  end
end

.to_obf(path, dest_path) ⇒ Object



30
31
32
33
# File 'lib/obf/unknown_file.rb', line 30

def self.to_obf(path, dest_path)
  ext = to_external(path)
  OBF::External.to_obf(ext, dest_path)
end

.to_obf_or_obz(path, dest_path_no_extension) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/obf/unknown_file.rb', line 21

def self.to_obf_or_obz(path, dest_path_no_extension)
  ext = to_external(path)
  if !ext['boards'] || (ext['boards'] && ext['boards'].length == 1)
    OBF::External.to_obf(ext, dest_path_no_extension + ".obf", {})
  else
    OBF::External.to_obz(ext, dest_path_no_extension + ".obz", {})
  end
end

.to_obz(path, dest_path) ⇒ Object



35
36
37
38
# File 'lib/obf/unknown_file.rb', line 35

def self.to_obz(path, dest_path)
  ext = to_external(path)
  OBF::External.to_obz(ext, dest_path, {})
end

.to_pdf(path, dest_path) ⇒ Object



40
41
42
43
# File 'lib/obf/unknown_file.rb', line 40

def self.to_pdf(path, dest_path)
  ext = to_external(path)
  OBF::External.to_pdf(ext, dest_path, {})
end

.to_png(path, dest_path) ⇒ Object



45
46
47
48
# File 'lib/obf/unknown_file.rb', line 45

def self.to_png(path, dest_path)
  ext = to_external(path)
  OBF::External.to_png(ext, dest_path, {})
end