Sha256: b5f33b83dcb66847047ccbcdf636c15b22ceb716e2df14866a432d3b49ff7ca5

Contents?: true

Size: 588 Bytes

Versions: 1

Compression:

Stored size: 588 Bytes

Contents

require "mongoid/nested_serialization/core_ext"
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.new(self).find(json)
      end
    end
    
    module InstanceMethods
      def finder_json
        Mongoid::NestedSerialization::Serializer.new(self).to_json
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-nested-serialization-0.0.1 lib/mongoid/nested_serialization.rb