Sha256: 94c37a651cc8326caa2e00141f403f3a831dae40332ef5fe68504373ca88eaef
Contents?: true
Size: 335 Bytes
Versions: 4
Compression:
Stored size: 335 Bytes
Contents
require "json" require "sawyer" module Underway class SawyerToJson def self.convert(object) JSON.generate(unwrap(object)) end def self.unwrap(object) case object when Array then object.map { |o| unwrap(o) } when Sawyer::Resource then object.to_hash else object end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
underway-2.0.0 | lib/underway/sawyer_to_json.rb |
underway-1.1.0 | lib/underway/sawyer_to_json.rb |
underway-1.0.1 | lib/underway/sawyer_to_json.rb |
underway-1.0.0 | lib/underway/sawyer_to_json.rb |