Module: Conflow::Redis::Findable Private

Included in:
Flow
Defined in:
lib/conflow/redis/findable.rb

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.

Findable module allows to use .find method on models with identifiers. It requires additional field: :type

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

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.

Adds :type field to store class name of the Findable object



9
10
11
12
# File 'lib/conflow/redis/findable.rb', line 9

def self.included(base)
  base.extend ClassMethods
  base.field :type, :value
end

Instance Method Details

#initialize(*args) ⇒ 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.

Adds logic for assigning class name as type



15
16
17
18
# File 'lib/conflow/redis/findable.rb', line 15

def initialize(*args)
  super
  self.type = self.class.name
end