Module: Conflow::Redis::Findable::ClassMethods Private
- 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.
Adds .find method which accepts ID and returns model of proper (sub)type
Instance Method Summary collapse
-
#find(id) ⇒ Object
private
Creates new Conflow::Redis::Findable object from ID.
Instance Method Details
#find(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.
Creates new Conflow::Redis::Findable object from ID.
26 27 28 29 30 31 |
# File 'lib/conflow/redis/findable.rb', line 26 def find(id) class_name = ValueField.new(format(key_template + ":type", id: id)).value raise ::Redis::CommandError, "#{name} with ID #{id} doesn't exist" unless class_name Object.const_get(class_name).new(id) end |