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 = <<~MESSAGE
    The #{doc.name} Redis command might be dangerous.

    #{doc.url}

    ACL categories: #{doc.acl_categories.join(" ")}

    Complexity: #{doc.complexity}

    If you're sure this is okay, you can try again within `SaferRedis.really { ... }`
  MESSAGE

  if doc.suggestion
    message = <<~MESSAGE
      #{message}
      Suggestion: #{doc.suggestion.description}
    MESSAGE
  end

  super(message)
end