Class: Mysql2xxxx::Config
- Inherits:
-
Object
- Object
- Mysql2xxxx::Config
- Defined in:
- lib/mysql2xxxx/config.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #database ⇒ Object
- #execute ⇒ Object
- #host ⇒ Object
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
- #password ⇒ Object
- #port ⇒ Object
-
#slash_n ⇒ Object
Whether to write N instead of a blank string for NULL.
- #socket ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
4 5 6 |
# File 'lib/mysql2xxxx/config.rb', line 4 def initialize( = {}) @options = .symbolize_keys end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/mysql2xxxx/config.rb', line 3 def @options end |
Instance Method Details
#database ⇒ Object
28 29 30 |
# File 'lib/mysql2xxxx/config.rb', line 28 def database [:database] || active_record_connection.try(:current_database) end |
#execute ⇒ Object
32 33 34 |
# File 'lib/mysql2xxxx/config.rb', line 32 def execute [:execute] end |
#host ⇒ Object
16 17 18 |
# File 'lib/mysql2xxxx/config.rb', line 16 def host [:host] || active_record_config.try(:[], :host) end |
#password ⇒ Object
12 13 14 |
# File 'lib/mysql2xxxx/config.rb', line 12 def password [:password] || active_record_config.try(:[], :password) end |
#port ⇒ Object
20 21 22 |
# File 'lib/mysql2xxxx/config.rb', line 20 def port [:port] || active_record_config.try(:[], :port) end |
#slash_n ⇒ Object
Whether to write N instead of a blank string for NULL. This is helpful for mysqlimport.
Only applies to CSV
39 40 41 |
# File 'lib/mysql2xxxx/config.rb', line 39 def slash_n .fetch :slash_n, false end |
#socket ⇒ Object
24 25 26 |
# File 'lib/mysql2xxxx/config.rb', line 24 def socket [:socket] || active_record_config.try(:[], :socket) end |
#user ⇒ Object
8 9 10 |
# File 'lib/mysql2xxxx/config.rb', line 8 def user [:user] || active_record_config.try(:[], :username) end |