Module: Khronos::Storage::Adapter

Defined in:
lib/khronos/storage/adapter.rb,
lib/khronos/storage/adapter/mongoid.rb,
lib/khronos/storage/adapter/activerecord.rb,
lib/khronos/storage/adapter/mongoid/schedule.rb,
lib/khronos/storage/adapter/mongoid/schedule_log.rb,
lib/khronos/storage/adapter/activerecord/schedule.rb,
lib/khronos/storage/adapter/activerecord/schedule_log.rb,
lib/khronos/storage/adapter/activerecord/migrations/schedule.rb,
lib/khronos/storage/adapter/activerecord/migrations/schedule_log.rb

Defined Under Namespace

Modules: ActiveRecord, Mongoid

Class Method Summary collapse

Class Method Details

.get(url) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/khronos/storage/adapter.rb', line 29

def self.get(url)
  uri = parse_uri(url)
  framework = @frameworks[uri[:scheme]]
  require "khronos/storage/adapter/#{framework}"

  # Get and connect with the adapter class.
  const_get(@classes[framework]).connect!(url)
end

.parse_uri(uri) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/khronos/storage/adapter.rb', line 18

def self.parse_uri(uri)
  data = URI.parse(uri)
  {
    :scheme     => data.scheme,
    :host       => data.host,
    :user       => data.user,
    :password   => data.password,
    :path       => data.path
  }
end