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.



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/origami/file.rb', line 127

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.



120
121
122
# File 'lib/origami/file.rb', line 120

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

.Unix(file) ⇒ Object

Converts UNIX file path into PDF file path.



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

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