Class: HornOfPlenty::Repositories::Board

Inherits:
Object
  • Object
show all
Defined in:
lib/horn_of_plenty/repositories/board.rb

Class Method Summary collapse

Class Method Details

.adapter_class_for(adapter) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/horn_of_plenty/repositories/board.rb', line 13

def self.adapter_class_for(adapter)
  adapter_class_name = "HornOfPlenty::" \
                       "Adapters::" \
                       "#{HornOfPlenty::CoreExt::String.camelize(adapter)}::" \
                       "Repositories::" \
                       "Board"

  require HornOfPlenty::CoreExt::String.underscore(adapter_class_name)

  HornOfPlenty::CoreExt::String.constantize(adapter_class_name)
end

.fetch(**attrs) ⇒ Object



7
8
9
10
11
# File 'lib/horn_of_plenty/repositories/board.rb', line 7

def self.fetch(**attrs)
  adapter = attrs.delete(:adapter)

  adapter_class_for(adapter).fetch(**attrs)
end