class Rack::Prefer::PreferPresenter
Attributes
values[R]
Public Class Methods
new(req)
click to toggle source
# File lib/rack/prefer.rb, line 8 def initialize(req) @values = CGI.parse( (req.env['HTTP_PREFER'] || '').gsub(',','&').gsub(' ','') ) @values = {} if !@values.is_a?(Hash) @values.each{|k,v| @values[k] = v.first} if Object.const_defined?(:HashWithIndifferentAccess) @values = HashWithIndifferentAccess.new(@values) end end
Public Instance Methods
handling()
click to toggle source
# File lib/rack/prefer.rb, line 43 def handling @values['handling'] end
handling_lanient?()
click to toggle source
# File lib/rack/prefer.rb, line 51 def handling_lanient? @values['handling'] == 'lanient' end
handling_strict?()
click to toggle source
# File lib/rack/prefer.rb, line 47 def handling_strict? @values['handling'] == 'strict' end
respond_async?()
click to toggle source
# File lib/rack/prefer.rb, line 27 def respond_async? @values.key?('respond-async') end
return()
click to toggle source
# File lib/rack/prefer.rb, line 31 def return @values['return'] end
return_minimal?()
click to toggle source
# File lib/rack/prefer.rb, line 39 def return_minimal? @values['return'] == 'minimal' end
return_representaton?()
click to toggle source
# File lib/rack/prefer.rb, line 35 def return_representaton? @values['return'] == 'representation' end
wait()
click to toggle source
# File lib/rack/prefer.rb, line 23 def wait @values['wait'].to_i end
wait?()
click to toggle source
# File lib/rack/prefer.rb, line 19 def wait? @values.key?('wait') end