Class: RFuseSymbolicFS
- Inherits:
-
Object
- Object
- RFuseSymbolicFS
- Defined in:
- lib/rfuse_symbolic_fs.rb
Instance Method Summary collapse
- #contents(path) ⇒ Object
- #directory?(path) ⇒ Boolean
- #file?(path) ⇒ Boolean
-
#initialize(options) ⇒ RFuseSymbolicFS
constructor
rubydoc.info/gems/fusefs/0.7.0/FuseFS/MetaDir contents( path ) file?( path ) directory?( path ) read_file( path ) size( path ).
- #read_file(path) ⇒ Object
- #size(path) ⇒ Object
Constructor Details
#initialize(options) ⇒ RFuseSymbolicFS
rubydoc.info/gems/fusefs/0.7.0/FuseFS/MetaDir contents( path ) file?( path ) directory?( path ) read_file( path ) size( path )
save touch( path ) can_write?(path) write_to(path,body)
can_delete?(path) delete( path )
can_mkdir?( path ) mkdir( path ) can_rmdir( path ) rmdir( path )
28 29 30 |
# File 'lib/rfuse_symbolic_fs.rb', line 28 def initialize( ) @base_dir = .input end |
Instance Method Details
#contents(path) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rfuse_symbolic_fs.rb', line 32 def contents(path) n_path = File.( File.join(@base_dir, path ) ) Dir.chdir(n_path) files = Dir.glob('*') #Added command to OS X Finder not to index. files << 'metadata_never_index' return files end |
#directory?(path) ⇒ Boolean
52 53 54 |
# File 'lib/rfuse_symbolic_fs.rb', line 52 def directory?(path) File.directory?( File.join( @base_dir, path ) ) end |
#file?(path) ⇒ Boolean
43 44 45 46 47 48 49 50 |
# File 'lib/rfuse_symbolic_fs.rb', line 43 def file?(path) #If path ends with metadata_never_index it is a file if path =~ /metadata_never_index$/ return true end return (not File.directory?( File.join( @base_dir, path ) ) ) end |
#read_file(path) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/rfuse_symbolic_fs.rb', line 56 def read_file(path) #puts "read file #{path}" if File.exists?( File.join( @base_dir, path ) ) return File.new( File.join( @base_dir, path ) , "r").read end return "ERROR, file not found\n" end |
#size(path) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/rfuse_symbolic_fs.rb', line 67 def size(path) if File.exists?( File.join( @base_dir, path ) ) return File.size( File.join( @base_dir, path ) ) else return 16 end end |