Sha256: effc61142819ca6287890d977ad306bc18a1f85e45a9ee3f97ad2ffcdbfcfe7f
Contents?: true
Size: 601 Bytes
Versions: 2
Compression:
Stored size: 601 Bytes
Contents
module Ki class BaseRequest < Rack::Request include FormatOf def root? path == '/' end def json? content_type == 'application/json' || format_of(path) == 'json' end def to_ki_model_class self.path.to_s.gsub('/','').gsub(format_of(path), '').gsub('.', '').to_class end 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ki-0.4.2 | lib/ki/base_request.rb |
ki-0.4.1 | lib/ki/base_request.rb |