Class: Shaf::Parser::FormData

Inherits:
Base
  • Object
show all
Defined in:
lib/shaf/parser/form_data.rb

Instance Attribute Summary

Attributes inherited from Base

#body, #request

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize, mime_type

Constructor Details

This class inherits a constructor from Shaf::Parser::Base

Class Method Details

.can_handle?(request) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/shaf/parser/form_data.rb', line 4

def self.can_handle?(request)
  request.form_data? || request.parseable_data?
end

Instance Method Details

#callObject



8
9
10
11
12
# File 'lib/shaf/parser/form_data.rb', line 8

def call
  request.POST.tap do |data| # Returns form params from Rack::Request
    data.delete '_method' # If the method override hack is used remove the _method key
  end
end