Class: Khronos::Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/khronos/storage.rb,
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: Adapter

Instance Method Summary collapse

Constructor Details

#initialize(uri = ENV['KHRONOS_STORAGE']) ⇒ Storage

Returns a new instance of Storage.

Raises:

  • (RuntimeError)


7
8
9
10
11
12
# File 'lib/khronos/storage.rb', line 7

def initialize(uri=ENV['KHRONOS_STORAGE'])
  raise RuntimeError.new("Please configure 'KHRONOS_STORAGE' on your environment variables.") if uri.nil?

  @adapter = Adapter.get(uri)
  self.class.send(:include, @adapter)
end

Instance Method Details

#logger=(logger) ⇒ Object

Raises:

  • (NotImplementedMethod)


14
15
16
17
18
19
# File 'lib/khronos/storage.rb', line 14

def logger=(logger)
  #
  # Change logger current adapter's logger
  #
  raise NotImplementedMethod
end

#truncate!Object



21
22
23
24
# File 'lib/khronos/storage.rb', line 21

def truncate!
  Schedule.delete_all
  ScheduleLog.delete_all
end