Sha256: e89d369f4ac2082499812937677069f932f6f5faaa500eefb22f491b3f04a48b
Contents?: true
Size: 655 Bytes
Versions: 4
Compression:
Stored size: 655 Bytes
Contents
module Cistern::Singular include Cistern::Model def self.cistern_singular(cistern, klass, name) cistern.const_get(:Collections).module_eval <<-EOS, __FILE__, __LINE__ def #{name}(attributes={}) #{klass.name}.new(attributes.merge(cistern: self)) end EOS end def self.included(klass) super klass.send(:extend, Cistern::Attributes::ClassMethods) klass.send(:include, Cistern::Attributes::InstanceMethods) klass.send(:extend, Cistern::Model::ClassMethods) end def collection self end def get raise NotImplementedError end def reload get self end alias load reload end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cistern-2.6.0 | lib/cistern/singular.rb |
cistern-2.5.0 | lib/cistern/singular.rb |
cistern-2.4.1 | lib/cistern/singular.rb |
cistern-2.4.0 | lib/cistern/singular.rb |