Class: LogRotate::RotateInfoIntegerExtension
- Inherits:
-
Object
- Object
- LogRotate::RotateInfoIntegerExtension
- 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_counts ⇒ Object
This field is an array of rotated file names and counts.
Instance Method Summary collapse
- #==(value) ⇒ Object
-
#initialize(rotated_files_and_counts, rotated_files, deleted_files, new_rotated_file) ⇒ RotateInfoIntegerExtension
constructor
Description: This method creates a RotateInfoIntegerExtension instance.
- #to_s ⇒ Object
Constructor Details
#initialize(rotated_files_and_counts, rotated_files, deleted_files, new_rotated_file) ⇒ RotateInfoIntegerExtension
Description:
This method creates a RotateInfoIntegerExtension instance.
124 125 126 127 128 129 130 131 132 |
# File 'lib/logrotate/rotateinfo.rb', line 124 def initialize(rotated_files_and_counts, rotated_files, deleted_files, new_rotated_file) @rotated_files_and_counts = rotated_files_and_counts @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.
112 113 114 |
# File 'lib/logrotate/rotateinfo.rb', line 112 def deleted_files @deleted_files end |
#new_rotated_file ⇒ Object
The newly rotated file name created by the rotate_file method call.
118 119 120 |
# File 'lib/logrotate/rotateinfo.rb', line 118 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_counts field.
106 107 108 |
# File 'lib/logrotate/rotateinfo.rb', line 106 def rotated_files @rotated_files end |
#rotated_files_and_counts ⇒ Object
This field is an array of rotated file names and counts. Each element is a hash containing the following fields:
file-
A rotated file name.
index-
The associated index of the rotated file.
99 100 101 |
# File 'lib/logrotate/rotateinfo.rb', line 99 def rotated_files_and_counts @rotated_files_and_counts end |
Instance Method Details
#==(value) ⇒ Object
134 135 136 137 138 139 |
# File 'lib/logrotate/rotateinfo.rb', line 134 def ==(value) return (@rotated_files_and_counts == value.rotated_files_and_counts && @rotated_files == value.rotated_files && @deleted_files == value.deleted_files && @new_rotated_file == value.new_rotated_file) end |
#to_s ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/logrotate/rotateinfo.rb', line 141 def to_s() os = StringIO.new os.print "Rotated Files/Directories And Counts:\n" @rotated_files_and_counts.each do |element| os.print " file -> ", element[:file], ", index -> ", element[:index], "\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 |