TABLE_PRIVILEGES = [
:select, :insert, :update, :delete, :truncate, :references, :trigger
- ]
+ ].freeze
def initialize(cluster)
@cluster = cluster
def parse_acl(acl)
acl.sub(/^\{(.*)\}$/, "\\1").split(",").each_with_object({}) do |entry, permissions|
- entry = entry.sub(/^"(.*)"$/) { Regexp.last_match[1].gsub(/\\"/, '"') }.sub(/\/.*$/, "")
+ entry = entry.sub(/^"(.*)"$/) { Regexp.last_match[1].gsub(/\\"/, '"') }.sub(%r{/.*$}, "")
user, privileges = entry.split("=")
user = user.sub(/^"(.*)"$/, "\\1")
permissions[user] = {
"a" => :insert, "r" => :select, "w" => :update, "d" => :delete,
"D" => :truncate, "x" => :references, "t" => :trigger
- }.values_at(*(privileges.chars)).compact
+ }.values_at(*privileges.chars).compact
end
end
end