about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-04-26 12:56:20 -0700
committerEric Wong <normalperson@yhbt.net>2011-04-26 12:57:01 -0700
commite3c8152e016fe29f76a996b8802df7158c081db0 (patch)
treea930962fa256899c8e3f942197481808110c0ef5
parent012d3e3d1ae9186434efcaa746f25118683fe8b3 (diff)
downloadrainbows-e3c8152e016fe29f76a996b8802df7158c081db0.tar.gz
No need to expose things that don't need exposing.
-rw-r--r--lib/rainbows/stream_file.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/rainbows/stream_file.rb b/lib/rainbows/stream_file.rb
index 4a77a2f..08a9c2d 100644
--- a/lib/rainbows/stream_file.rb
+++ b/lib/rainbows/stream_file.rb
@@ -5,10 +5,17 @@
 # models.  We always maintain our own file offsets in userspace because
 # because sendfile() implementations offer pread()-like idempotency for
 # concurrency (multiple clients can read the same underlying file handle).
-class Rainbows::StreamFile < Struct.new(:offset, :count, :to_io, :body)
+class Rainbows::StreamFile
+  attr_reader :to_io
+  attr_accessor :offset, :count
+
+  def initialize(offset, count, io, body)
+    @offset, @count, @to_io, @body = offset, count, io, body
+  end
+
   def close
-    body.close if body.respond_to?(:close)
-    to_io.close unless to_io.closed?
-    self.to_io = nil
+    @body.close if @body.respond_to?(:close)
+    @to_io.close unless @to_io.closed?
+    @to_io = nil
   end
 end