Class: Sinatra::Streaming::FileStreamer
- Inherits:
-
Object
- Object
- Sinatra::Streaming::FileStreamer
- Defined in:
- lib/codebutler/sinatra.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(path, options) ⇒ FileStreamer
constructor
A new instance of FileStreamer.
- #to_result(cx, *args) ⇒ Object
Constructor Details
#initialize(path, options) ⇒ FileStreamer
Returns a new instance of FileStreamer.
225 226 227 |
# File 'lib/codebutler/sinatra.rb', line 225 def initialize(path, ) @path, = path, end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
223 224 225 |
# File 'lib/codebutler/sinatra.rb', line 223 def end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
223 224 225 |
# File 'lib/codebutler/sinatra.rb', line 223 def path @path end |
Instance Method Details
#each ⇒ Object
233 234 235 236 237 238 239 |
# File 'lib/codebutler/sinatra.rb', line 233 def each File.open(path, 'rb') do |file| while buf = file.read([:buffer_size]) yield buf end end end |
#to_result(cx, *args) ⇒ Object
229 230 231 |
# File 'lib/codebutler/sinatra.rb', line 229 def to_result(cx, *args) self end |