Sha256: 2eaabed4b4c574581733df211c32fe733d72b1d44e5bd0c49fc904d475be134e

Contents?: true

Size: 530 Bytes

Versions: 2

Compression:

Stored size: 530 Bytes

Contents

require "mongoid/nested_serialization/finder"
require "mongoid/nested_serialization/serializer"

module Mongoid
  module NestedSerialization
    def self.included(base)
      base.extend ClassMethods
      base.send :include, InstanceMethods
    end
    
    module ClassMethods
      def find_by_json(json)
        Mongoid::NestedSerialization::Finder.find(json)
      end
    end
    
    module InstanceMethods
      def finder_json
        Mongoid::NestedSerialization::Serializer.new(self).to_json
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid-nested-serialization-0.0.4 lib/mongoid/nested_serialization.rb
mongoid-nested-serialization-0.0.3 lib/mongoid/nested_serialization.rb