Module: SaferRedis

Defined in:
lib/safer_redis.rb,
lib/safer_redis/danger.rb,
lib/safer_redis/version.rb,
lib/safer_redis/assessor.rb,
lib/safer_redis/suggestion.rb,
lib/safer_redis/command_doc.rb,
lib/safer_redis/interceptor.rb

Defined Under Namespace

Modules: Interceptor Classes: Assessor, CommandDoc, Danger, Error, Suggestion

Constant Summary collapse

VERSION =
"1.2.0"

Class Method Summary collapse

Class Method Details

.activate!(klass: Redis) ⇒ Object



9
10
11
12
# File 'lib/safer_redis.rb', line 9

def self.activate!(klass: Redis)
  klass.prepend(SaferRedis::Interceptor)
  @active = true
end

.active?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/safer_redis.rb', line 18

def self.active?
  defined?(@active) ? @active : false
end

.deactivate!Object



14
15
16
# File 'lib/safer_redis.rb', line 14

def self.deactivate!
  @active = false
end

.reallyObject



22
23
24
25
26
27
28
# File 'lib/safer_redis.rb', line 22

def self.really
  was = active?
  @active = false
  yield
ensure
  @active = was
end