Sha256: 28f9fa379173e717b9e1781e99c720211d60b11f3da7ae14a52c8f5c7970536d
Contents?: true
Size: 792 Bytes
Versions: 6
Compression:
Stored size: 792 Bytes
Contents
require "sfn" module Sfn module Utils # JSON helper methods module JSON # Convert to JSON # # @param thing [Object] # @return [String] def _to_json(thing) MultiJson.dump(thing) end alias_method :dump_json, :_to_json # Load JSON data # # @param thing [String] # @return [Object] def _from_json(thing) MultiJson.load(thing) end alias_method :load_json, :_from_json # Format object into pretty JSON # # @param thing [Object] # @return [String] def _format_json(thing) thing = _from_json(thing) if thing.is_a?(String) MultiJson.dump(thing, :pretty => true) end alias_method :format_json, :_format_json end end end
Version data entries
6 entries across 6 versions & 1 rubygems