Class: Kybus::Storage::Datasource::IDGenerators

Inherits:
Object
  • Object
show all
Extended by:
DRY::ResourceInjector
Defined in:
lib/kybus/storage/datasource/id_generators.rb

Overview

This class was meant to handle the complexity of extracting the primary key from an object that belongs to a model. This might get deprecated or suffer a huge refactor.

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



11
12
13
# File 'lib/kybus/storage/datasource/id_generators.rb', line 11

def self.[](key)
  resource(:generators, key)
end

.normalize_id(object, key) ⇒ Object



15
16
17
# File 'lib/kybus/storage/datasource/id_generators.rb', line 15

def self.normalize_id(object, key)
  object.is_a?(Hash) || object.nil? ? object[key] : object
end