Class: FSLayer::File

Inherits:
Object
  • Object
show all
Defined in:
lib/fs_layer/file.rb

Class Method Summary collapse

Instance Method Summary collapse

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

#destinationObject



31
32
33
# File 'lib/fs_layer/file.rb', line 31

def destination
  Pathname.new(@file).realpath.to_s
end

#exist?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/fs_layer/file.rb', line 23

def exist?
  ::File.exists? @file
end

#nameObject



19
20
21
# File 'lib/fs_layer/file.rb', line 19

def name
  ::File.basename @file
end

#pathObject



35
36
37
# File 'lib/fs_layer/file.rb', line 35

def path
  @file
end

#symlink?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/fs_layer/file.rb', line 27

def symlink?
  ::File.symlink? @file
end