Sha256: 390d2b0da34c2e3532d42fdeaaefc7cfca87f5bc19cb8b682384305fe0e972ae
Contents?: true
Size: 437 Bytes
Versions: 11
Compression:
Stored size: 437 Bytes
Contents
require 'multi_json' module Bixby module Jsonify include Hashify def to_json(*opts) MultiJson.dump(self.to_hash) end module ClassMethods def from_json(json) json = MultiJson.load(json) if json.kind_of? String obj = self.allocate json.each{ |k,v| obj.send("#{k}=".to_sym, v) } obj end end def self.included(receiver) receiver.extend(ClassMethods) end end # Jsonify end # Bixby
Version data entries
11 entries across 11 versions & 1 rubygems