Class: DataMask::DBShell
- Inherits:
-
Object
- Object
- DataMask::DBShell
- Defined in:
- lib/data_mask/db_shell.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #export(**opt) ⇒ Object
- #import(filepath = nil) ⇒ Object
-
#initialize(options) ⇒ DBShell
constructor
A new instance of DBShell.
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 = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/data_mask/db_shell.rb', line 3 def @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 |