9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/gratan/client.rb', line 9
def export(options = {})
options = @options.merge(options)
exported = Gratan::Exporter.export(@driver, options)
if block_given?
exported.sort_by {|user_host, attrs|
user_host[0].empty? ? 'root' : user_host[0]
}.chunk {|user_host, attrs|
user_host[0].empty? ? 'root' : user_host[0]
}.each {|user, grants|
h = {}
grants.sort_by {|k, v| k }.each {|k, v| h[k] = v }
dsl = Gratan::DSL.convert(h, options)
yield(user, dsl)
}
else
exported = Gratan::Exporter.export(@driver, options)
Gratan::DSL.convert(exported, options)
end
end
|