Class: FSLayer::File
- Inherits:
-
Object
- Object
- FSLayer::File
- Defined in:
- lib/fs_layer/file.rb
Class Method Summary collapse
Instance Method Summary collapse
- #destination ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(file) ⇒ File
constructor
A new instance of File.
- #name ⇒ Object
- #path ⇒ Object
- #symlink? ⇒ Boolean
Constructor Details
#initialize(file) ⇒ File
Returns a new instance of File.
15 16 17 |
# File 'lib/fs_layer/file.rb', line 15 def initialize file @file = file end |
Class Method Details
.add(file) ⇒ Object
5 6 7 8 9 |
# File 'lib/fs_layer/file.rb', line 5 def self.add file FileUtils.touch file unless FSLayer.fake? Index.organize file new file end |
.retrieve(filename) ⇒ Object
11 12 13 |
# File 'lib/fs_layer/file.rb', line 11 def self.retrieve filename new filename end |
Instance Method Details
#destination ⇒ Object
31 32 33 |
# File 'lib/fs_layer/file.rb', line 31 def destination Pathname.new(@file).realpath.to_s end |
#exist? ⇒ Boolean
23 24 25 |
# File 'lib/fs_layer/file.rb', line 23 def exist? ::File.exists? @file end |
#name ⇒ Object
19 20 21 |
# File 'lib/fs_layer/file.rb', line 19 def name ::File.basename @file end |
#path ⇒ Object
35 36 37 |
# File 'lib/fs_layer/file.rb', line 35 def path @file end |
#symlink? ⇒ Boolean
27 28 29 |
# File 'lib/fs_layer/file.rb', line 27 def symlink? ::File.symlink? @file end |