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.



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

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.



97
98
99
# File 'lib/origami/filespec.rb', line 97

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

.Unix(file) ⇒ Object

Converts UNIX file path into PDF file path.



90
91
92
# File 'lib/origami/filespec.rb', line 90

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