Module: Ext::NegociateContent::Base

Defined in:
lib/ext/negociate_content.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#acceptObject

Returns the value of attribute accept.



66
67
68
# File 'lib/ext/negociate_content.rb', line 66

def accept
  @accept
end

Instance Method Details

#respond_toObject

TODO : Refine this method



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/ext/negociate_content.rb', line 69

def respond_to
  selector = ContentSelector.new(env)
  data = yield selector

  unless data
    @status = 406
    @headers['Content-Type'] = 'text/html'
    data = selector.available_content_types
  end
 
  data
end