class Dumptruck::Load
Attributes
database[RW]
Specify a Database [TODO] if database isn’t specified then –all-databases is used
Public Class Methods
new(params = {})
click to toggle source
# File lib/dumptruck/load.rb, line 6 def initialize(params = {}) defaults = { options: ["--single-transaction", "--opt", "--skip-comments"], }.merge!(params) @options = defaults[:options] @database = params[:database] || '--all-databases' unless params[:options].nil? params[:options].each do |o| add_option(o) end end unless params[:ignored_tables].nil? params[:ignored_tables].each do |t| add_ignored_table(t) end end end
Public Instance Methods
add_ignored_table(table)
click to toggle source
# File lib/dumptruck/load.rb, line 27 def add_ignored_table(table) @ignored_tables = [] unless @ignored_tables @ignored_tables << table end
add_option(option)
click to toggle source
# File lib/dumptruck/load.rb, line 32 def add_option(option) @options = [] unless @options @options << option end
ignored_tables()
click to toggle source
# File lib/dumptruck/load.rb, line 45 def ignored_tables return nil unless @ignored_tables tables = "" @ignored_tables.each do |e| tables << "--ignore-table=#{@database}.#{e} " end tables.strip end
options()
click to toggle source
# File lib/dumptruck/load.rb, line 37 def options cmd = "" @options.each do |o| cmd << "#{o} " end cmd.strip end