lib/cistern/singular.rb in cistern-2.2.7 vs lib/cistern/singular.rb in cistern-2.3.0
- old
+ new
@@ -1,20 +1,28 @@
module Cistern::Singular
- def self.service_singular(service, klass, name)
- service.const_get(:Collections).module_eval <<-EOS, __FILE__, __LINE__
+ def self.cistern_singular(cistern, klass, name)
+ cistern.const_get(:Collections).module_eval <<-EOS, __FILE__, __LINE__
def #{name}(attributes={})
- #{klass.name}.new(attributes.merge(service: self))
+ #{klass.name}.new(attributes.merge(cistern: self))
end
EOS
end
def self.included(klass)
klass.send(:extend, Cistern::Attributes::ClassMethods)
klass.send(:include, Cistern::Attributes::InstanceMethods)
klass.send(:extend, Cistern::Model::ClassMethods)
end
- attr_accessor :service
+ attr_accessor :cistern
+
+ def service
+ Cistern.deprecation(
+ '#service is deprecated. Please use #cistern',
+ caller[0]
+ )
+ @cistern
+ end
def inspect
Cistern.formatter.call(self)
end