lib/cistern/model.rb in cistern-2.2.3 vs lib/cistern/model.rb in cistern-2.2.4
- old
+ new
@@ -14,32 +14,32 @@
end
EOS
end
module ClassMethods
- def service_method(name=nil)
+ def service_method(name = nil)
@_service_method ||= name
end
end
attr_accessor :collection, :service
def inspect
Cistern.formatter.call(self)
end
- def initialize(attributes={})
+ def initialize(attributes = {})
merge_attributes(attributes)
end
def update(attributes)
merge_attributes(attributes)
save
end
def save
- raise NotImplementedError
+ fail NotImplementedError
end
def reload
requires :identity
@@ -51,31 +51,31 @@
end
def ==(comparison_object)
super ||
(comparison_object.is_a?(self.class) &&
- comparison_object.identity == self.identity &&
+ comparison_object.identity == identity &&
!comparison_object.new_record?)
end
- alias :eql? :==
+ alias_method :eql?, :==
def hash
- if self.identity
- [self.class, self.identity].join(":").hash
+ if identity
+ [self.class, identity].join(':').hash
else
super
end
end
- def wait_for(timeout = self.service_class.timeout, interval = self.service_class.poll_interval, &block)
+ def wait_for(timeout = service_class.timeout, interval = service_class.poll_interval, &block)
service_class.wait_for(timeout, interval) { reload && block.call(self) }
end
- def wait_for!(timeout = self.service_class.timeout, interval = self.service_class.poll_interval, &block)
+ def wait_for!(timeout = service_class.timeout, interval = service_class.poll_interval, &block)
service_class.wait_for!(timeout, interval) { reload && block.call(self) }
end
def service_class
- self.service ? self.service.class : Cistern
+ service ? service.class : Cistern
end
end