Class: CtoD::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ctoD/cli.rb

Instance Method Summary collapse

Instance Method Details

#create_table(from, to) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/ctoD/cli.rb', line 15

def create_table(from, to)
  db = DB.new(from, to, string_size: options[:string_size])
  if db.table_exists?
    puts "Table '#{db.table_name}' exsist."
  else
    db.create_table
    puts "Table '#{db.table_name}' created at #{db.uri}."
  end
  db
end

#export(from, to) ⇒ Object



7
8
9
10
11
# File 'lib/ctoD/cli.rb', line 7

def export(from, to)
  db = create_table(from, to)
  db.export
  puts "CSV data exported successfully."
end