Class: TeXzip::Project::FilePath

Inherits:
Object
  • Object
show all
Defined in:
lib/texzip/Project.rb

Instance Method Summary collapse

Constructor Details

#initialize(root_dir, file) ⇒ FilePath

Returns a new instance of FilePath.



20
21
22
23
24
25
# File 'lib/texzip/Project.rb', line 20

def initialize(root_dir, file)
    @root_dir = Pathname.new(root_dir).expand_path
    @file = Pathname.new(file)
    @file = @root_dir.join(file).expand_path.relative_path_from(@root_dir)
 @out_file = @file
end

Instance Method Details

#eql?(file_path) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/texzip/Project.rb', line 60

def eql?(file_path)
    path.to_s.eql? file_path.path.to_s
end

#extnameObject



52
53
54
# File 'lib/texzip/Project.rb', line 52

def extname
    @file.extname
end

#fileObject



36
37
38
# File 'lib/texzip/Project.rb', line 36

def file
    @file
end

#hashObject



56
57
58
# File 'lib/texzip/Project.rb', line 56

def hash
    path.to_s.hash
end

#out_file=(file) ⇒ Object



40
41
42
# File 'lib/texzip/Project.rb', line 40

def out_file= file
 @out_file = Pathname.new(file)
end

#output_pathObject



44
45
46
# File 'lib/texzip/Project.rb', line 44

def output_path
    @out_dir.join(@out_file).expand_path
end

#pathObject



48
49
50
# File 'lib/texzip/Project.rb', line 48

def path
    @root_dir.join(@file).expand_path
end

#set_output_directory(dir) ⇒ Object



27
28
29
# File 'lib/texzip/Project.rb', line 27

def set_output_directory dir
    @out_dir = Pathname.new(dir).expand_path
end

#set_plain_output_directory(dir) ⇒ Object



31
32
33
34
# File 'lib/texzip/Project.rb', line 31

def set_plain_output_directory dir
 set_output_directory dir
 @out_file = @file.basename
end