Class: Origami::Filename

Inherits:
Object
  • Object
show all
Defined in:
lib/origami/filespec.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.



102
103
104
105
106
107
108
109
110
111
112
# File 'lib/origami/filespec.rb', line 102

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

  file.tr!("\\", "/")
  LiteralString.new(path + file)
end

.Mac(file) ⇒ Object

Converts MacOS file path into PDF file path.



95
96
97
# File 'lib/origami/filespec.rb', line 95

def Mac(file)
  LiteralString.new("/" + file.tr(":", "/"))
end

.Unix(file) ⇒ Object

Converts UNIX file path into PDF file path.



88
89
90
# File 'lib/origami/filespec.rb', line 88

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