Module: Kiba::Plus::Helper
- Included in:
- Destination::Mysql, Destination::MysqlBulk, Destination::PgBulk, Destination::PgBulk2, Job, Source::Mysql, Source::Pg
- Defined in:
- lib/kiba/plus/helper.rb
Instance Method Summary collapse
Instance Method Details
#format_sql(sql) ⇒ Object
23 24 25 |
# File 'lib/kiba/plus/helper.rb', line 23 def format_sql(sql) sql.to_s.gsub(/[\n][\s]*[\n]/, "\n") end |
#mysql2_connect_hash(url) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/kiba/plus/helper.rb', line 5 def mysql2_connect_hash(url) return url if url.is_a?(Hash) u = URI.parse(url) { host: u.host, port: u.port, username: u.user, password: u.password, database: u.path[1..-1] } end |
#scheme(url) ⇒ Object
18 19 20 21 |
# File 'lib/kiba/plus/helper.rb', line 18 def scheme(url) u = URI.parse(url) u.scheme end |