Class: DataMask::DBShell

Inherits:
Object
  • Object
show all
Defined in:
lib/data_mask/db_shell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ DBShell

Returns a new instance of DBShell.



5
6
7
# File 'lib/data_mask/db_shell.rb', line 5

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/data_mask/db_shell.rb', line 3

def options
  @options
end

Instance Method Details

#export(**opt) ⇒ Object



9
10
11
12
13
14
# File 'lib/data_mask/db_shell.rb', line 9

def export(**opt)
  cmd = ''
  cmd += send("#{@options[:adapter]}_cmd", 'export')
  cmd += "> %{database}-masking-#{Time.now.to_f.to_i}.sql" % @options if opt[:to_file]
  cmd
end

#import(filepath = nil) ⇒ Object



16
17
18
19
20
21
# File 'lib/data_mask/db_shell.rb', line 16

def import(filepath=nil)
  cmd = ''
  cmd += send("#{@options[:adapter]}_cmd", 'import')
  cmd += "< #{filepath}" if filepath
  cmd
end