Class: PoringBackup::Database
- Inherits:
-
Object
- Object
- PoringBackup::Database
- Defined in:
- lib/poring_backup/database.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#file_dir ⇒ Object
readonly
Returns the value of attribute file_dir.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#setting ⇒ Object
readonly
Returns the value of attribute setting.
-
#tmp_dir ⇒ Object
readonly
Returns the value of attribute tmp_dir.
-
#tmp_file_path ⇒ Object
readonly
Returns the value of attribute tmp_file_path.
Instance Method Summary collapse
- #backup ⇒ Object
- #clear_tmp! ⇒ Object
-
#initialize(setting, &block) ⇒ Database
constructor
A new instance of Database.
Constructor Details
#initialize(setting, &block) ⇒ Database
Returns a new instance of Database.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/poring_backup/database.rb', line 9 def initialize setting, &block @created_at = setting.created_at @setting = setting @path ||= 'db_backups' @file ||= 'db_backup.psql' gen_file_dir gen_file_path gen_tmp_dir gen_tmp_file_path end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
7 8 9 |
# File 'lib/poring_backup/database.rb', line 7 def created_at @created_at end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/poring_backup/database.rb', line 5 def file @file end |
#file_dir ⇒ Object (readonly)
Returns the value of attribute file_dir.
6 7 8 |
# File 'lib/poring_backup/database.rb', line 6 def file_dir @file_dir end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
5 6 7 |
# File 'lib/poring_backup/database.rb', line 5 def file_path @file_path end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/poring_backup/database.rb', line 6 def path @path end |
#setting ⇒ Object (readonly)
Returns the value of attribute setting.
4 5 6 |
# File 'lib/poring_backup/database.rb', line 4 def setting @setting end |
#tmp_dir ⇒ Object (readonly)
Returns the value of attribute tmp_dir.
6 7 8 |
# File 'lib/poring_backup/database.rb', line 6 def tmp_dir @tmp_dir end |
#tmp_file_path ⇒ Object (readonly)
Returns the value of attribute tmp_file_path.
5 6 7 |
# File 'lib/poring_backup/database.rb', line 5 def tmp_file_path @tmp_file_path end |
Instance Method Details
#backup ⇒ Object
21 22 23 |
# File 'lib/poring_backup/database.rb', line 21 def backup FileUtils.mkdir_p(tmp_dir) end |
#clear_tmp! ⇒ Object
25 26 27 |
# File 'lib/poring_backup/database.rb', line 25 def clear_tmp! FileUtils.rm_rf(tmp_file_path) end |