Class: LockManager::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/lock_manager/connection.rb

Direct Known Subclasses

RedisConnection

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Connection

Returns a new instance of Connection.



15
16
17
# File 'lib/lock_manager/connection.rb', line 15

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/lock_manager/connection.rb', line 3

def options
  @options
end

Class Method Details

.connection_class(type) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/lock_manager/connection.rb', line 5

def self.connection_class(type)
  case type.to_s
  when 'redis'
    require 'lock_manager/redis_connection'
    LockManager::RedisConnection
  else
    raise ArgumentError, "Unknown connection type: #{type}"
  end
end

Instance Method Details

#read(key) ⇒ Object



23
24
25
# File 'lib/lock_manager/connection.rb', line 23

def read(key)
  raise "Not implemented: read(#{key})"
end

#remove(key) ⇒ Object



27
28
29
# File 'lib/lock_manager/connection.rb', line 27

def remove(key)
  raise "Not implemented: remove(#{key})"
end

#write(key, value) ⇒ Object



19
20
21
# File 'lib/lock_manager/connection.rb', line 19

def write(key, value)
  raise "Not implemented: write(#{key}, #{value})"
end