Sha256: 28215cb65cd3e2d2d0a48fa1e949805a72e6078982e1593c848d1dc161195252

Contents?: true

Size: 609 Bytes

Versions: 7

Compression:

Stored size: 609 Bytes

Contents

require "rack"
require "json"

module Getto
  module Roda
    module Decode
      class Post
        def initialize(content_type, body)
          @content_type = content_type
          @body = body
        end

        def to_h
          return unless @content_type == "application/json"
          ::JSON.parse @body
        rescue ::JSON::ParserError
          nil
        end
      end

      class Get
        def initialize(query_string)
          @query_string = query_string
        end

        def to_h
          ::Rack::Utils.parse_nested_query(@query_string)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
getto-roda-1.1.3 lib/getto/roda/decode.rb
getto-roda-1.1.2 lib/getto/roda/decode.rb
getto-roda-1.1.1 lib/getto/roda/decode.rb
getto-roda-1.1.0 lib/getto/roda/decode.rb
getto-roda-1.0.0 lib/getto/roda/decode.rb
getto-roda-0.1.0 lib/getto/roda/decode.rb
getto-roda-0.2.0 lib/getto/roda/decode.rb