Class: LogRotate::RotateInfoDateExtension
- Inherits:
-
Object
- Object
- LogRotate::RotateInfoDateExtension
- Defined in:
- lib/logrotate/rotateinfo.rb
Overview
This class is one of the possible return values from the LogRotate::rotate_file method. It contains information about the rotated files.
Instance Attribute Summary collapse
-
#deleted_files ⇒ Object
An array of file names that were deleted during the rotate_file method call.
-
#new_rotated_file ⇒ Object
The newly rotated file name created by the rotate_file method call.
-
#rotated_files ⇒ Object
An array of rotated file names.
-
#rotated_files_and_dates ⇒ Object
This field is an array of rotated file names and dates.
Instance Method Summary collapse
- #==(value) ⇒ Object
-
#initialize(rotated_files_and_dates, rotated_files, deleted_files, new_rotated_file) ⇒ RotateInfoDateExtension
constructor
Description: This method creates a RotateInfoDateExtension instance.
- #to_s ⇒ Object
Constructor Details
#initialize(rotated_files_and_dates, rotated_files, deleted_files, new_rotated_file) ⇒ RotateInfoDateExtension
Description:
This method creates a RotateInfoDateExtension instance.
45 46 47 48 49 50 51 52 53 |
# File 'lib/logrotate/rotateinfo.rb', line 45 def initialize(rotated_files_and_dates, rotated_files, deleted_files, new_rotated_file) @rotated_files_and_dates = rotated_files_and_dates @rotated_files = rotated_files @deleted_files = deleted_files @new_rotated_file = new_rotated_file end |
Instance Attribute Details
#deleted_files ⇒ Object
An array of file names that were deleted during the rotate_file method call.
33 34 35 |
# File 'lib/logrotate/rotateinfo.rb', line 33 def deleted_files @deleted_files end |
#new_rotated_file ⇒ Object
The newly rotated file name created by the rotate_file method call.
39 40 41 |
# File 'lib/logrotate/rotateinfo.rb', line 39 def new_rotated_file @new_rotated_file end |
#rotated_files ⇒ Object
An array of rotated file names. This list of file names will be the same as the file names listed in the rotated_files_and_dates field.
27 28 29 |
# File 'lib/logrotate/rotateinfo.rb', line 27 def rotated_files @rotated_files end |
#rotated_files_and_dates ⇒ Object
This field is an array of rotated file names and dates. Each element is a hash containing the following fields:
file-
A rotated file name.
date_time-
The associated date of the rotated file.
20 21 22 |
# File 'lib/logrotate/rotateinfo.rb', line 20 def rotated_files_and_dates @rotated_files_and_dates end |
Instance Method Details
#==(value) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/logrotate/rotateinfo.rb', line 55 def ==(value) return (@rotated_files_and_dates == value.rotated_files_and_dates && @rotated_files == value.rotated_files && @deleted_files == value.deleted_files && @new_rotated_file == value.new_rotated_file) end |
#to_s ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/logrotate/rotateinfo.rb', line 62 def to_s() os = StringIO.new os.print "Rotated Files/Directories And Dates:\n" @rotated_files_and_dates.each do |element| os.print " file -> ", element[:file], ", date_time -> ", element[:date_time], "\n" end os.print "Rotated Files/Directories: \n" if (@rotated_files.length() > 0) os.print " ", @rotated_files.join("\n "), "\n" end os.print "Deleted Files/Directories:\n" if (@deleted_files.length() > 0) os.print " ", @deleted_files.join("\n "), "\n" end os.print "Newly Rotated File/Directory: \n" os.print " ", @new_rotated_file, "\n" return os.string() end |