Class: MonitoringReporter::MySQL
- Inherits:
-
Object
- Object
- MonitoringReporter::MySQL
- Defined in:
- lib/monitoringreporter/mysql.rb
Overview
This is mysql class to request the databse.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(opts) ⇒ MySQL
constructor
Class constructor method.
- #query(query) ⇒ Object
Constructor Details
#initialize(opts) ⇒ MySQL
Class constructor method
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/monitoringreporter/mysql.rb', line 24 def initialize(opts) @opts = opts @my = Mysql.connect( opts['host'], opts['user'], opts['password'], opts['database'], opts['port'], opts['socket'] ) end |
Instance Method Details
#query(query) ⇒ Object
36 37 38 |
# File 'lib/monitoringreporter/mysql.rb', line 36 def query(query) @my.query(query).to_a end |