class Ki::BaseRequest
Public Instance Methods
admin?()
click to toggle source
# File lib/ki/base_request.rb, line 15 def admin? path == '/instadmin' end
doc?()
click to toggle source
# File lib/ki/base_request.rb, line 11 def doc? path == '/instadoc' end
headers()
click to toggle source
# File lib/ki/base_request.rb, line 23 def headers Hash[*env.select { |k, _v| k.start_with? 'HTTP_' } .collect { |k, v| [k.sub(/^HTTP_/, ''), v] } .sort .flatten] end
json?()
click to toggle source
# File lib/ki/base_request.rb, line 19 def json? content_type == 'application/json' || format_of(path) == 'json' end
root?()
click to toggle source
# File lib/ki/base_request.rb, line 7 def root? path == '/' end
to_action()
click to toggle source
# File lib/ki/base_request.rb, line 34 def to_action case request_method when 'GET' :find when 'POST' :create when 'PUT' :update when 'DELETE' :delete when 'SEARCH' :find else raise 'unkown action' end end
to_ki_model_class()
click to toggle source
# File lib/ki/base_request.rb, line 30 def to_ki_model_class path.to_s.delete('/').gsub(format_of(path), '').delete('.').to_class end