Sha256: 78f590c0441ad9961a4b27f8f82e49a20957ce8620425e2454ead85f0954b028
Contents?: true
Size: 651 Bytes
Versions: 37
Compression:
Stored size: 651 Bytes
Contents
class CustomClass attr_reader :name def initialize(name) @name = name end def ==(other) other.is_a?(self.class) && name == other.name end def to_mongo { :name => name } end def self.from_mongo(hash) new(hash[:name]) end def self.cast(value) new(value.to_s) end end class CustomClassWithDefault < CustomClass def self.mongomodel_default(doc) new("Custom class default") end end class CustomClassWithAccessors < CustomClass def self.mongomodel_accessors(property) Module.new do define_method(:custom_accessor) do "Custom accessor method" end end end end
Version data entries
37 entries across 37 versions & 1 rubygems