Class: Origami::Filename

Inherits:
Object
  • Object
show all
Defined in:
lib/origami/file.rb

Overview

Class used to convert system-dependent pathes into PDF pathes. PDF path specification offers a single form for representing file pathes over operating systems.

Class Method Summary collapse

Class Method Details

.DOS(file) ⇒ Object

Converts Windows file path into PDF file path.



121
122
123
124
125
126
127
128
129
130
131
# File 'lib/origami/file.rb', line 121

def DOS(file)
  path = ""
  # Absolute vs relative path
  if file.include? ":"
    path << "/"
    file.sub!(":","")
  end
  
  file.gsub!("\\", "/")
  ByteString.new(path + file)
end

.Mac(file) ⇒ Object

Converts MacOS file path into PDF file path.



114
115
116
# File 'lib/origami/file.rb', line 114

def Mac(file)
  ByteString.new("/" + file.gsub(":", "/"))
end

.Unix(file) ⇒ Object

Converts UNIX file path into PDF file path.



107
108
109
# File 'lib/origami/file.rb', line 107

def Unix(file)
  ByteString.new(file)
end