Class: Rumination::Pg::Restore
- Inherits:
-
Object
- Object
- Rumination::Pg::Restore
- Defined in:
- lib/rumination/pg/restore.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(*args) ⇒ Restore
constructor
A new instance of Restore.
Constructor Details
#initialize(*args) ⇒ Restore
Returns a new instance of Restore.
6 7 8 9 |
# File 'lib/rumination/pg/restore.rb', line 6 def initialize *args require "open3" @args = args.dup.freeze end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
4 5 6 |
# File 'lib/rumination/pg/restore.rb', line 4 def args @args end |
Class Method Details
.call(*args) ⇒ Object
11 12 13 |
# File 'lib/rumination/pg/restore.rb', line 11 def self.call *args new(*args).call end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rumination/pg/restore.rb', line 15 def call command = "pg_restore #{args.join(" ")}" puts command Open3.popen3 ENV, command do |stdin, stdout, stderr, thread| out_lines = stdout.readlines err_lines = stderr.readlines save_stream :stdout, out_lines save_stream :stderr, err_lines puts_log out_lines + err_lines, indent: 2 analyse_stderr! err_lines end end |