Class: SendFile

Inherits:
Object
  • Object
show all
Defined in:
lib/fsws/server.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ SendFile

Returns a new instance of SendFile.



38
39
40
# File 'lib/fsws/server.rb', line 38

def initialize(path)
  @file = File.open(path, 'rb')
end

Instance Method Details

#closeObject



42
43
44
# File 'lib/fsws/server.rb', line 42

def close
  @file.close
end

#eachObject



46
47
48
49
50
# File 'lib/fsws/server.rb', line 46

def each
  while (buffer = @file.read(4096)) do
    yield buffer
  end
end