Class: PgExport::Dump
- Inherits:
-
Object
- Object
- PgExport::Dump
- Defined in:
- lib/pg_export/dump.rb
Constant Summary collapse
- TIMESTAMP_REGEX =
'[0-9]{8}_[0-9]{6}'.freeze
Instance Attribute Summary collapse
-
#basename ⇒ Object
readonly
Returns the value of attribute basename.
-
#basename_gz ⇒ Object
readonly
Returns the value of attribute basename_gz.
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#dirname ⇒ Object
readonly
Returns the value of attribute dirname.
-
#ftp_regexp ⇒ Object
readonly
Returns the value of attribute ftp_regexp.
-
#pathname ⇒ Object
readonly
Returns the value of attribute pathname.
-
#pathname_gz ⇒ Object
readonly
Returns the value of attribute pathname_gz.
-
#regexp ⇒ Object
readonly
Returns the value of attribute regexp.
Instance Method Summary collapse
-
#initialize(a_database, a_dir) ⇒ Dump
constructor
A new instance of Dump.
- #size ⇒ Object
- #size_gz ⇒ Object
Constructor Details
#initialize(a_database, a_dir) ⇒ Dump
Returns a new instance of Dump.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pg_export/dump.rb', line 7 def initialize(a_database, a_dir) @database = a_database @dir = a_dir @dirname = absolute_path(dir) @basename = append_to_database(Time.now.strftime('%Y%m%d_%H%M%S')) @basename_gz = basename + '.gz' @regexp = Regexp.new(append_to_database(TIMESTAMP_REGEX)) @ftp_regexp = append_to_database('*') @pathname = [dirname, basename].join('/') @pathname_gz = pathname + '.gz' create_dir_if_necessary end |
Instance Attribute Details
#basename ⇒ Object (readonly)
Returns the value of attribute basename.
5 6 7 |
# File 'lib/pg_export/dump.rb', line 5 def basename @basename end |
#basename_gz ⇒ Object (readonly)
Returns the value of attribute basename_gz.
5 6 7 |
# File 'lib/pg_export/dump.rb', line 5 def basename_gz @basename_gz end |
#database ⇒ Object (readonly)
Returns the value of attribute database.
5 6 7 |
# File 'lib/pg_export/dump.rb', line 5 def database @database end |
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
5 6 7 |
# File 'lib/pg_export/dump.rb', line 5 def dir @dir end |
#dirname ⇒ Object (readonly)
Returns the value of attribute dirname.
5 6 7 |
# File 'lib/pg_export/dump.rb', line 5 def dirname @dirname end |
#ftp_regexp ⇒ Object (readonly)
Returns the value of attribute ftp_regexp.
5 6 7 |
# File 'lib/pg_export/dump.rb', line 5 def ftp_regexp @ftp_regexp end |
#pathname ⇒ Object (readonly)
Returns the value of attribute pathname.
5 6 7 |
# File 'lib/pg_export/dump.rb', line 5 def pathname @pathname end |
#pathname_gz ⇒ Object (readonly)
Returns the value of attribute pathname_gz.
5 6 7 |
# File 'lib/pg_export/dump.rb', line 5 def pathname_gz @pathname_gz end |
#regexp ⇒ Object (readonly)
Returns the value of attribute regexp.
5 6 7 |
# File 'lib/pg_export/dump.rb', line 5 def regexp @regexp end |
Instance Method Details
#size ⇒ Object
20 21 22 |
# File 'lib/pg_export/dump.rb', line 20 def size file_size(pathname) end |
#size_gz ⇒ Object
24 25 26 |
# File 'lib/pg_export/dump.rb', line 24 def size_gz file_size(pathname_gz) end |