Module: Redis::Objects::ClassMethods
- Defined in:
- lib/redis/objects.rb
Overview
Class methods that appear in your class when you include Redis::Objects.
Instance Attribute Summary collapse
-
#redis_objects ⇒ Object
attr_accessor :redis, :redis_objects.
Instance Method Summary collapse
-
#field_key(name, id) ⇒ Object
:nodoc:.
-
#prefix ⇒ Object
:nodoc:.
-
#prefix=(prefix) ⇒ Object
Set the Redis prefix to use.
Instance Attribute Details
#redis_objects ⇒ Object
attr_accessor :redis, :redis_objects
74 75 76 |
# File 'lib/redis/objects.rb', line 74 def redis_objects @redis_objects end |
Instance Method Details
#field_key(name, id) ⇒ Object
:nodoc:
86 87 88 |
# File 'lib/redis/objects.rb', line 86 def field_key(name, id) #:nodoc: "#{prefix}:#{id}:#{name}" end |
#prefix ⇒ Object
:nodoc:
78 79 80 81 82 83 84 |
# File 'lib/redis/objects.rb', line 78 def prefix #:nodoc: @prefix ||= self.name.to_s. sub(%r{(.*::)}, ''). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). downcase end |
#prefix=(prefix) ⇒ Object
Set the Redis prefix to use. Defaults to model_name
77 |
# File 'lib/redis/objects.rb', line 77 def prefix=(prefix) @prefix = prefix end |