Module: Redis::Objects::Lists::ClassMethods
- Defined in:
- lib/redis/objects/lists.rb
Overview
Class methods that appear in your class when you include Redis::Objects.
Instance Attribute Summary collapse
-
#lists ⇒ Object
readonly
Returns the value of attribute lists.
Instance Method Summary collapse
-
#list(name, options = {}) ⇒ Object
Define a new list.
Instance Attribute Details
#lists ⇒ Object (readonly)
Returns the value of attribute lists.
15 16 17 |
# File 'lib/redis/objects/lists.rb', line 15 def lists @lists end |
Instance Method Details
#list(name, options = {}) ⇒ Object
Define a new list. It will function like a regular instance method, so it can be used alongside ActiveRecord, DataMapper, etc.
19 20 21 22 23 24 25 26 |
# File 'lib/redis/objects/lists.rb', line 19 def list(name, ={}) @lists[name] = class_eval <<-EndMethods def #{name} @#{name} ||= Redis::List.new(field_key(:#{name}), redis, self.class.lists[:#{name}]) end EndMethods end |