Module: ActionController::CgiExt::Stdinput

Included in:
CGI
Defined in:
lib/action_controller/cgi_ext/stdinput.rb

Overview

Publicize the CGI’s internal input stream so we can lazy-read request.body. Make it writable so we don’t have to play $stdin games.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/action_controller/cgi_ext/stdinput.rb', line 8

def self.included(base)
  base.class_eval do
    remove_method :stdinput
    attr_accessor :stdinput
  end

  base.alias_method_chain :initialize, :stdinput
end

Instance Method Details

#initialize_with_stdinput(type = nil, stdinput = $stdin) ⇒ Object



17
18
19
20
# File 'lib/action_controller/cgi_ext/stdinput.rb', line 17

def initialize_with_stdinput(type = nil, stdinput = $stdin)
  @stdinput = stdinput
  initialize_without_stdinput(type || 'query')
end