Class: ThinOutBackups::Command::File
- Inherits:
-
Pathname
- Object
- Pathname
- ThinOutBackups::Command::File
- Defined in:
- lib/thin_out_backups.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
- #full_path ⇒ Object
- #has_time? ⇒ Boolean
- #ignored? ⇒ Boolean
-
#initialize(filename) ⇒ File
constructor
A new instance of File.
- #time ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(filename) ⇒ File
Returns a new instance of File.
134 135 136 |
# File 'lib/thin_out_backups.rb', line 134 def initialize(filename) super(Pathname.new(filename)) end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
132 133 134 |
# File 'lib/thin_out_backups.rb', line 132 def file @file end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
132 133 134 |
# File 'lib/thin_out_backups.rb', line 132 def filename @filename end |
Instance Method Details
#full_path ⇒ Object
138 139 140 |
# File 'lib/thin_out_backups.rb', line 138 def full_path dirname.to_s + '/' + filename end |
#has_time? ⇒ Boolean
164 |
# File 'lib/thin_out_backups.rb', line 164 def has_time?; !!time end |
#ignored? ⇒ Boolean
165 166 167 168 |
# File 'lib/thin_out_backups.rb', line 165 def ignored? !has_time? or ThinOutBackups::Command.ignore_files && filename =~ ThinOutBackups::Command.ignore_files end |
#time ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/thin_out_backups.rb', line 149 def time if ThinOutBackups::Command.get_time_from == :filename if filename =~ ThinOutBackups::Command.time_format y,m,d, h,i,s = $1,$2,$3, $4,$5,$6 Time.mktime(y,m,d, h,i,s) else nil end elsif ThinOutBackups::Command.get_time_from == :file_system file.mtime else raise "Unknown value for #{ThinOutBackups::Command.get_time_from}" end end |
#to_s ⇒ Object
145 146 147 |
# File 'lib/thin_out_backups.rb', line 145 def to_s filename end |