Class: SendFile
- Inherits:
-
Object
- Object
- SendFile
- Defined in:
- lib/fsws/server.rb
Instance Method Summary collapse
- #close ⇒ Object
- #each ⇒ Object
-
#initialize(path) ⇒ SendFile
constructor
A new instance of SendFile.
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
#close ⇒ Object
42 43 44 |
# File 'lib/fsws/server.rb', line 42 def close @file.close end |
#each ⇒ Object
46 47 48 49 50 |
# File 'lib/fsws/server.rb', line 46 def each while (buffer = @file.read(4096)) do yield buffer end end |