lib/unread_mongoid/reader.rb in unread-mongoid-0.0.5 vs lib/unread_mongoid/reader.rb in unread-mongoid-0.1.0

- old
+ new

@@ -1,15 +1,9 @@ module UnreadMongoid module Reader - module InstanceMethods - def read_mark_global(klass) - instance_var_name = "@read_mark_global_#{klass.name.gsub('::','_')}" - if instance_variables.include?(instance_var_name.to_sym) - instance_variable_get(instance_var_name) - else # memoize - obj = self.read_marks.where(:readable_type => klass.name).global.first - instance_variable_set(instance_var_name, obj) - end + def self.assert_reader(obj) + unless obj.kind_of?(UnreadMongoid::Reader) + raise ArgumentError, "Class #{obj.class.name} is not registered by acts_as_reader!" end end end end