Sha256: 4765754f62d2ee6384c1df6d0e59522064731edda25f0233ca6b8cd9efe196ff

Contents?: true

Size: 491 Bytes

Versions: 5

Compression:

Stored size: 491 Bytes

Contents

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
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unread-mongoid-0.0.5 lib/unread_mongoid/reader.rb
unread-mongoid-0.0.4 lib/unread_mongoid/reader.rb
unread-mongoid-0.0.3 lib/unread_mongoid/reader.rb
unread-mongoid-0.0.2 lib/unread_mongoid/reader.rb
unread-mongoid-0.0.1 lib/unread_mongoid/reader.rb