Class: Yahns::MaxBody::RewindableWrapper

Inherits:
Wrapper
  • Object
show all
Defined in:
lib/yahns/max_body/rewindable_wrapper.rb

Overview

Copyright © 2009-2013, Eric Wong <[email protected]> et. al. License: GPLv2 or later (www.gnu.org/licenses/gpl-2.0.txt)

Instance Method Summary collapse

Methods inherited from Wrapper

#checked_read, #each, #gets, #read, #read_all

Constructor Details

#initialize(rack_input, limit) ⇒ RewindableWrapper

:nodoc:



5
6
7
8
# File 'lib/yahns/max_body/rewindable_wrapper.rb', line 5

def initialize(rack_input, limit)
  @orig_limit = limit
  super
end

Instance Method Details

#rewindObject



10
11
12
13
14
# File 'lib/yahns/max_body/rewindable_wrapper.rb', line 10

def rewind
  @limit = @orig_limit
  @rbuf = ''
  @input.rewind
end

#sizeObject



16
17
18
# File 'lib/yahns/max_body/rewindable_wrapper.rb', line 16

def size
  @input.size
end