class Bagatelle::MysqlStorage
Attributes
connection[RW]
Public Class Methods
new(params)
click to toggle source
# File lib/bagatelle.rb, line 9 def initialize(params) @connection ||= Mysql2::Client.new(params) end
Public Instance Methods
build_query(table, key, value)
click to toggle source
# File lib/bagatelle.rb, line 17 def build_query(table, key, value) wrapped_val = "IN(#{value.join(', ')})" "SELECT * FROM #{table} WHERE #{key} #{wrapped_val}" end
query(table, key, value)
click to toggle source
# File lib/bagatelle.rb, line 13 def query(table, key, value) connection.query(build_query(table, key, value)) end