Sha256: 8ba85497ef70a5ffc2cc9f4d75b2d80d96d7f9d239df107dcbecb22a7363c3f2
Contents?: true
Size: 1019 Bytes
Versions: 3
Compression:
Stored size: 1019 Bytes
Contents
require 'candy/piece' module Candy # A subclass of Hash that behaves like a Candy::Piece. This class has two major uses: # # * It's a convenient starting point if you just want to store a bunch of data in Mongo # and don't need to implement any business logic in your own classes; and # * It's the default when you embed hashed data in another Candy::Piece and don't # supply another object class. Because it doesn't need to store a classname, using # it means less metadata in your collections. # # If you don't tell them otherwise, top-level CandyHash objects store themselves in # the 'candy' collection. You can change that at any time by setting a different # collection at the class or object level. class CandyHash < Hash include Crunch include Piece self.collection = 'candy' # Overrides the default behavior in Candy::Piece so that we DO NOT add our # class name to the saved values. def to_candy candy end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
candy-0.2.9 | lib/candy/hash.rb |
candy-0.2.8 | lib/candy/hash.rb |
candy-0.2.7 | lib/candy/hash.rb |