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.



115
116
117
118
119
120
121
122
123
124
125
# File 'lib/origami/file.rb', line 115

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.



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

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

.Unix(file) ⇒ Object

Converts UNIX file path into PDF file path.



101
102
103
# File 'lib/origami/file.rb', line 101

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