Class: Baza::Driver::Mysql::User

Inherits:
Object
  • Object
show all
Defined in:
lib/baza/driver/mysql/user.rb

Direct Known Subclasses

Baza::Driver::Mysql2::User

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ User

Returns a new instance of User.



4
5
6
7
8
# File 'lib/baza/driver/mysql/user.rb', line 4

def initialize(args)
  @args = args
  @data = args.fetch(:data)
  @db = args.fetch(:db)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/baza/driver/mysql/user.rb', line 2

def name
  @name
end

Instance Method Details

#dropObject



18
19
20
21
# File 'lib/baza/driver/mysql/user.rb', line 18

def drop
  @db.query("DROP USER '#{@db.esc(name)}'@'#{@db.esc(host)}'")
  true
end

#hostObject



14
15
16
# File 'lib/baza/driver/mysql/user.rb', line 14

def host
  @data.fetch(:Host)
end