class Grantinee::Dsl
Attributes
permissions[RW]
Public Class Methods
eval(commands)
click to toggle source
Allow evaluation of the code coming from the Grantinee
file
# File lib/grantinee/dsl.rb, line 8 def self.eval(commands) new.tap do |x| x.eval(commands) end end
new()
click to toggle source
Initialize defaults
# File lib/grantinee/dsl.rb, line 15 def initialize @permissions = [] @data = {} end
Public Instance Methods
eval(commands)
click to toggle source
# File lib/grantinee/dsl.rb, line 20 def eval(commands) instance_eval(commands) end
Private Instance Methods
logger()
click to toggle source
# File lib/grantinee/dsl.rb, line 59 def logger Grantinee.logger end
on(database, &block)
click to toggle source
Define database and mode
# File lib/grantinee/dsl.rb, line 27 def on(database, &block) logger.debug "Got database: #{database}" @data[:database] = database instance_eval(&block) if block_given? end
user(user, &block)
click to toggle source
Define user and host Note: revokes all permissions for given user first
# File lib/grantinee/dsl.rb, line 37 def user(user, &block) logger.debug "Got user: #{user}" @data[:user], @data[:host] = user.to_s.split '@' @data[:host] ||= '%' instance_eval(&block) if block_given? end