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
# 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)
  else
    raise "unrecognized file type"
  end
end

.to_obf(path, dest_path) ⇒ Object



28
29
30
31
# File 'lib/obf/unknown_file.rb', line 28

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



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

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



33
34
35
36
# File 'lib/obf/unknown_file.rb', line 33

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



38
39
40
41
# File 'lib/obf/unknown_file.rb', line 38

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



43
44
45
46
# File 'lib/obf/unknown_file.rb', line 43

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