Class: Yahns::MaxBody::RewindableWrapper

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

Overview

Copyright © 2013-2016 all contributors <[email protected]> License: GPLv2 or later (www.gnu.org/licenses/gpl-2.0.txt) frozen_string_literal: true

Instance Method Summary collapse

Methods inherited from Wrapper

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

Constructor Details

#initialize(rack_input, limit) ⇒ RewindableWrapper

:nodoc:



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

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

Instance Method Details

#rewindObject



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

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

#sizeObject



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

def size
  @input.size
end