Module: Conflow::Redis::Identifier Private
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Identifier changes logic of fields so that they can be found by an id. ID is a counter stored in redis under .counter_key Key is build with template stored in .key_template
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
private
ID of the model.
Class Method Summary collapse
-
.included(base) ⇒ Object
private
Extends base class with ClassMethods.
Instance Method Summary collapse
-
#initialize(id = self.class.generate_id) ⇒ Object
private
Overrides logic of Field#initialize, allowing creating objects with ID instead of full key.
Instance Attribute Details
#id ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
ID of the model
60 61 62 |
# File 'lib/conflow/redis/identifier.rb', line 60 def id @id end |
Class Method Details
.included(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Extends base class with ClassMethods
11 12 13 |
# File 'lib/conflow/redis/identifier.rb', line 11 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#initialize(id = self.class.generate_id) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Overrides logic of Field#initialize, allowing creating objects with ID instead of full key
64 65 66 67 |
# File 'lib/conflow/redis/identifier.rb', line 64 def initialize(id = self.class.generate_id) @id = id.to_i super(format(self.class.key_template, id: id)) end |