Class: Rack::UTF8Sanitizer::SanitizedRackInput

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/utf8_sanitizer.rb

Overview

Modeled after Rack::RewindableInput TODO: Should this delegate any methods to the original io?

Instance Method Summary collapse

Constructor Details

#initialize(original_io, sanitized_io) ⇒ SanitizedRackInput

Returns a new instance of SanitizedRackInput.



69
70
71
72
# File 'lib/rack/utf8_sanitizer.rb', line 69

def initialize(original_io, sanitized_io)
  @original_io = original_io
  @sanitized_io = sanitized_io
end

Instance Method Details

#closeObject



85
86
87
88
# File 'lib/rack/utf8_sanitizer.rb', line 85

def close
  @sanitized_io.close
  @original_io.close if @original_io.respond_to?(:close)
end

#each(&block) ⇒ Object



79
80
81
# File 'lib/rack/utf8_sanitizer.rb', line 79

def each(&block)
  @sanitized_io.each(&block)
end

#getsObject



73
74
75
# File 'lib/rack/utf8_sanitizer.rb', line 73

def gets
  @sanitized_io.gets
end

#read(*args) ⇒ Object



76
77
78
# File 'lib/rack/utf8_sanitizer.rb', line 76

def read(*args)
  @sanitized_io.read(*args)
end

#rewindObject



82
83
84
# File 'lib/rack/utf8_sanitizer.rb', line 82

def rewind
  @sanitized_io.rewind
end