Class: Database::Base

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

Direct Known Subclasses

Local, Remote

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cap_instance) ⇒ Base

Returns a new instance of Base.


4
5
6
# File 'lib/mysql.rb', line 4

def initialize(cap_instance)
  @cap = cap_instance
end

Instance Attribute Details

#configObject

Returns the value of attribute config


3
4
5
# File 'lib/mysql.rb', line 3

def config
  @config
end

#output_fileObject

Returns the value of attribute output_file


3
4
5
# File 'lib/mysql.rb', line 3

def output_file
  @output_file
end

Instance Method Details

#credentialsObject


12
13
14
# File 'lib/mysql.rb', line 12

def credentials
  " -u #{@config['username']} " + (@config['password'] ? " -p\"#{@config['password']}\" " : '') + (@config['host'] ? " -h #{@config['host']}" : '')
end

#databaseObject


16
17
18
# File 'lib/mysql.rb', line 16

def database
  @config['database']
end

#mysql?Boolean

Returns:

  • (Boolean)

8
9
10
# File 'lib/mysql.rb', line 8

def mysql?
  @config['adapter'] == 'mysql' || @config['adapter'] == 'mysql2'
end