Sha256: e841948d90ee6bbcdd5446c71996ab0227f74f60436c4ddefdfd3fe85bb4c341

Contents?: true

Size: 594 Bytes

Versions: 5

Compression:

Stored size: 594 Bytes

Contents

class Gratan::DSL::Context::User
  include Gratan::DSL::Validator

  attr_reader :result

  def initialize(user, host, &block)
    @error_identifier = "User `#{user}@#{host}`"
    @user = user
    @host = host
    @result = {}
    instance_eval(&block)
  end

  def on(name, options = {}, &block)
    name = name.to_s

    __validate("Object `#{name}` is already defined") do
      not @result.has_key?(name)
    end

    grant = {:privs => Gratan::DSL::Context::On.new(@user, @host, name, &block).result}
    grant[:with] = options[:with] if options[:with]
    @result[name] = grant
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gratan-0.1.4 lib/gratan/dsl/context/user.rb
gratan-0.1.3 lib/gratan/dsl/context/user.rb
gratan-0.1.2 lib/gratan/dsl/context/user.rb
gratan-0.1.1 lib/gratan/dsl/context/user.rb
gratan-0.1.0 lib/gratan/dsl/context/user.rb