about summary refs log tree commit
path: root/lib/metropolis/input_wrapper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/metropolis/input_wrapper.rb')
-rw-r--r--lib/metropolis/input_wrapper.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/metropolis/input_wrapper.rb b/lib/metropolis/input_wrapper.rb
new file mode 100644
index 0000000..12a1bcc
--- /dev/null
+++ b/lib/metropolis/input_wrapper.rb
@@ -0,0 +1,21 @@
+# -*- encoding: binary -*-
+
+class Metropolis::InputWrapper
+  def initialize(env)
+    @input = env["rack.input"]
+    env["rack.input"] = self
+  end
+
+  def read(*args)
+    args.empty? and return read_all
+    ni
+  end
+
+  def ni(*args)
+    raise NotImplementedError
+  end
+
+  alias gets ni
+  alias each ni
+  alias rewind ni
+end