class Redisabel::Search
Public Class Methods
new(pattern='*', asave=false)
click to toggle source
# File lib/redisabel/search.rb, line 4 def initialize(pattern='*', asave=false) @pattern = pattern @autosave = asave end
Public Instance Methods
keys()
click to toggle source
# File lib/redisabel/search.rb, line 9 def keys @keys ||= Database.db.keys(@pattern) end
objects()
click to toggle source
# File lib/redisabel/search.rb, line 13 def objects self.keys @objects ||= @keys.map do |key| object_name, id = key.split(':') next object_name.camelize.constantize.new(@autosave, id, Transformations.transform(key)) end end
objects_by_type()
click to toggle source
# File lib/redisabel/search.rb, line 22 def objects_by_type self.objects @objects_by_type ||= @objects.reduce({}) do |acc, obj| acc[obj.class] ||= [] acc[obj.class] << obj next acc end end