Exception: SaferRedis::Danger

Inherits:
Error
  • Object
show all
Defined in:
lib/safer_redis/danger.rb

Instance Method Summary collapse

Constructor Details

#initialize(doc) ⇒ Danger

Returns a new instance of Danger.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/safer_redis/danger.rb', line 5

def initialize(doc)
  message = "    The \#{doc.name} Redis command might be dangerous.\n\n    \#{doc.url}\n\n    ACL categories: \#{doc.acl_categories.join(\" \")}\n\n    Complexity: \#{doc.complexity}\n\n    If you're sure this is okay, you can try again within `SaferRedis.really { ... }`\n  MESSAGE\n\n  if doc.suggestion\n    message = <<~MESSAGE\n      \#{message}\n      Suggestion: \#{doc.suggestion.description}\n    MESSAGE\n  end\n\n  super(message)\nend\n"