class Getto::Roda::Decode::Post

Public Class Methods

new(content_type, body) click to toggle source
# File lib/getto/roda/decode.rb, line 8
def initialize(content_type, body)
  @content_type = content_type
  @body = body
end

Public Instance Methods

to_h() click to toggle source
# File lib/getto/roda/decode.rb, line 13
def to_h
  return unless @content_type == "application/json"
  ::JSON.parse @body
rescue ::JSON::ParserError
  nil
end