File: hello.rb

package info (click to toggle)
ruby-fusefs 0.7.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: ansic: 1,137; ruby: 760; sh: 8; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 403 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require "rubygems"
require 'fusefs'

class HelloDir
  def contents(path)
    ['hello.txt']
  end
  
  def file?(path)
    path == '/hello.txt'
  end
  
  def read_file(path)
    "Hello, World!\n"
  end

  def size(path)
    read_file(path).size
  end
end

hellodir = HelloDir.new
FuseFS.set_root( hellodir )

# Mount under a directory given on the command line.
FuseFS.mount_under ARGV.shift
FuseFS.run