Module: Akane::Storages

Defined in:
lib/akane/storages.rb,
lib/akane/storages/file.rb,
lib/akane/storages/mock.rb,
lib/akane/storages/stdout.rb,
lib/akane/storages/elasticsearch.rb,
lib/akane/storages/abstract_storage.rb

Defined Under Namespace

Classes: AbstractStorage, Elasticsearch, File, Mock, Stdout

Class Method Summary collapse

Class Method Details

.find(name) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/akane/storages.rb', line 3

def self.find(name)
  class_name = name.gsub(/(?:\A|_)(.)/) { $1.upcase }

  retried = false
  begin
    return Akane::Storages.const_get(class_name, false)
  rescue NameError => e
    raise e if retried
    retried = true
    require "akane/storages/#{name}"
    retry
  end
end