Class: Database::Base
- Inherits:
-
Object
- Object
- Database::Base
- Defined in:
- lib/mysql.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#output_file ⇒ Object
Returns the value of attribute output_file.
Instance Method Summary collapse
- #credentials ⇒ Object
- #database ⇒ Object
-
#initialize(cap_instance) ⇒ Base
constructor
A new instance of Base.
- #mysql? ⇒ Boolean
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
#config ⇒ Object
Returns the value of attribute config.
3 4 5 |
# File 'lib/mysql.rb', line 3 def config @config end |
#output_file ⇒ Object
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
#credentials ⇒ Object
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 |
#database ⇒ Object
16 17 18 |
# File 'lib/mysql.rb', line 16 def database @config['database'] end |
#mysql? ⇒ Boolean
8 9 10 |
# File 'lib/mysql.rb', line 8 def mysql? @config['adapter'] == 'mysql' || @config['adapter'] == 'mysql2' end |