Class: ActionController::RewindableInput::RewindableIO
- Inherits:
- ActiveSupport::BasicObject
- Defined in:
- lib/action_controller/rewindable_input.rb
Instance Method Summary collapse
-
#initialize(io) ⇒ RewindableIO
constructor
A new instance of RewindableIO.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(io) ⇒ RewindableIO
Returns a new instance of RewindableIO.
4 5 6 7 |
# File 'lib/action_controller/rewindable_input.rb', line 4 def initialize(io) @io = io @rewindable = io.is_a?(::StringIO) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/action_controller/rewindable_input.rb', line 9 def method_missing(method, *args, &block) unless @rewindable @io = ::StringIO.new(@io.read) @rewindable = true end @io.__send__(method, *args, &block) end |