Class: Redis::Attrs::Base
- Inherits:
-
Object
- Object
- Redis::Attrs::Base
- Defined in:
- lib/redis-attrs/base.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(klass, name, type, options) ⇒ Base
constructor
A new instance of Base.
- #redis ⇒ Object
- #redis_key(id) ⇒ Object
Constructor Details
#initialize(klass, name, type, options) ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'lib/redis-attrs/base.rb', line 6 def initialize(klass, name, type, ) @klass, @name, @type, @options = klass, name, type, end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
4 5 6 |
# File 'lib/redis-attrs/base.rb', line 4 def klass @klass end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/redis-attrs/base.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/redis-attrs/base.rb', line 4 def @options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/redis-attrs/base.rb', line 4 def type @type end |
Instance Method Details
#redis_key(id) ⇒ Object
14 15 16 17 |
# File 'lib/redis-attrs/base.rb', line 14 def redis_key(id) raise "id attribute is required in order to properly store Redis attributes" if id.nil? "#{klass.redis_key_prefix}:#{id}:#{name}" end |