Class: Loki::FilePath
- Inherits:
-
Object
- Object
- Loki::FilePath
- Defined in:
- lib/loki/file_path.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #absolute ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(path) ⇒ FilePath
constructor
A new instance of FilePath.
- #mtime ⇒ Object
- #relative(from = Dir.pwd) ⇒ Object
- #to_s ⇒ Object
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
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/loki/file_path.rb', line 3 def path @path end |
Instance Method Details
#absolute ⇒ Object
21 22 23 |
# File 'lib/loki/file_path.rb', line 21 def absolute ::File.(@path) end |
#exists? ⇒ Boolean
31 32 33 |
# File 'lib/loki/file_path.rb', line 31 def exists? ::File.exists?(@path) end |
#mtime ⇒ Object
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_s ⇒ Object
36 37 38 |
# File 'lib/loki/file_path.rb', line 36 def to_s @path.to_s end |