Sha256: 91ffe19c2aa9e2eb229bf443538eca587629144aabd4d76297b9a43da3b65ab1
Contents?: true
Size: 479 Bytes
Versions: 3
Compression:
Stored size: 479 Bytes
Contents
module JsonMatchers class Payload def initialize(payload) @payload = extract_json_string(payload) end def as_json JSON.parse(payload) end def to_s payload end private attr_reader :payload def extract_json_string(payload) if payload.respond_to?(:body) payload.body elsif payload.is_a?(Array) || payload.is_a?(Hash) payload.to_json else payload.to_s end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
json_matchers-0.11.1 | lib/json_matchers/payload.rb |
json_matchers-0.11.0 | lib/json_matchers/payload.rb |
json_matchers-0.10.0 | lib/json_matchers/payload.rb |