Class: Mysql2xxxx::Properties
- Inherits:
-
Object
- Object
- Mysql2xxxx::Properties
- Defined in:
- lib/mysql2xxxx/properties.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#charset ⇒ Object
MySQL connection charset.
- #database ⇒ Object
-
#encoding ⇒ Object
Encoding.
- #execute ⇒ Object
- #host ⇒ Object
-
#initialize(options = {}) ⇒ Properties
constructor
A new instance of Properties.
- #password ⇒ Object
- #port ⇒ Object
- #socket ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Properties
Returns a new instance of Properties.
4 5 6 7 |
# File 'lib/mysql2xxxx/properties.rb', line 4 def initialize( = {}) @options = .dup @options.stringify_keys! end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/mysql2xxxx/properties.rb', line 3 def @options end |
Instance Method Details
#charset ⇒ Object
MySQL connection charset
If you change this, you also have to change :encoding
Default: utf8
26 27 28 |
# File 'lib/mysql2xxxx/properties.rb', line 26 def charset ['charset'] || 'utf8' end |
#database ⇒ Object
47 48 49 |
# File 'lib/mysql2xxxx/properties.rb', line 47 def database ['database'] || active_record_connection.try(:current_database) end |
#encoding ⇒ Object
Encoding
If you change this, you also have to change :charset
Default: UTF-8
35 36 37 |
# File 'lib/mysql2xxxx/properties.rb', line 35 def encoding ['encoding'] || 'UTF-8' end |
#execute ⇒ Object
51 52 53 |
# File 'lib/mysql2xxxx/properties.rb', line 51 def execute ['execute'] end |
#host ⇒ Object
17 18 19 |
# File 'lib/mysql2xxxx/properties.rb', line 17 def host ['host'] || active_record_config.try(:[], :host) end |
#password ⇒ Object
13 14 15 |
# File 'lib/mysql2xxxx/properties.rb', line 13 def password ['password'] || active_record_config.try(:[], :password) end |
#port ⇒ Object
39 40 41 |
# File 'lib/mysql2xxxx/properties.rb', line 39 def port ['port'] || active_record_config.try(:[], :port) end |
#socket ⇒ Object
43 44 45 |
# File 'lib/mysql2xxxx/properties.rb', line 43 def socket ['socket'] || active_record_config.try(:[], :socket) end |
#user ⇒ Object
9 10 11 |
# File 'lib/mysql2xxxx/properties.rb', line 9 def user ['user'] || active_record_config.try(:[], :username) end |