Class: Loki::FilePath

Inherits:
Object
  • Object
show all
Defined in:
lib/loki/file_path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FilePath

Returns a new instance of FilePath.



6
7
8
# File 'lib/loki/file_path.rb', line 6

def initialize(path)
  self.path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/loki/file_path.rb', line 3

def path
  @path
end

Instance Method Details

#absoluteObject



21
22
23
# File 'lib/loki/file_path.rb', line 21

def absolute
  ::File.expand_path(@path)
end

#exists?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/loki/file_path.rb', line 31

def exists?
  ::File.exists?(@path)
end

#mtimeObject



26
27
28
# File 'lib/loki/file_path.rb', line 26

def mtime
  ::File.mtime(@path)
end

#relative(from = Dir.pwd) ⇒ Object



16
17
18
# File 'lib/loki/file_path.rb', line 16

def relative(from = Dir.pwd)
  @path.gsub(/^#{from}\//, '')
end

#to_sObject



36
37
38
# File 'lib/loki/file_path.rb', line 36

def to_s
  @path.to_s
end