class Razoul::Persistence::Database

Attributes

configuration[RW]
connection[W]

Public Class Methods

new(config = Razoul.configuration) click to toggle source
# File lib/razoul/persistence/database.rb, line 8
def initialize(config = Razoul.configuration)
  @configuration = config
end

Public Instance Methods

conn() click to toggle source
# File lib/razoul/persistence/database.rb, line 12
def conn
  @connection ||= call_module.configure(call_class, @configuration)
end
find(key) click to toggle source
# File lib/razoul/persistence/database.rb, line 20
def find(key)
  call_module.find(conn, key)
end
save(key, value) click to toggle source
# File lib/razoul/persistence/database.rb, line 16
def save(key, value)
  call_module.save(conn, key, value)
end

Private Instance Methods

call_class() click to toggle source
# File lib/razoul/persistence/database.rb, line 30
def call_class
  Object.const_get("::#{@configuration.database.capitalize}")
end
call_module() click to toggle source
# File lib/razoul/persistence/database.rb, line 26
def call_module
  Module.const_get("::Razoul::Persistence::#{@configuration.database.capitalize}")
end