Class: Adrian::RotatingDirectoryQueue
- Inherits:
-
DirectoryQueue
- Object
- Queue
- DirectoryQueue
- Adrian::RotatingDirectoryQueue
- Defined in:
- lib/adrian/rotating_directory_queue.rb
Instance Attribute Summary collapse
-
#time_format ⇒ Object
readonly
Returns the value of attribute time_format.
Attributes inherited from DirectoryQueue
Instance Method Summary collapse
- #available_path ⇒ Object
-
#initialize(options = {}) ⇒ RotatingDirectoryQueue
constructor
A new instance of RotatingDirectoryQueue.
Methods inherited from DirectoryQueue
create, #include?, #length, #pop_item, #push_item
Methods included from Filters
Methods inherited from Queue
#length, #max_age, #pop, #pop_item, #push, #push_item, #verify_age!
Constructor Details
#initialize(options = {}) ⇒ RotatingDirectoryQueue
Returns a new instance of RotatingDirectoryQueue.
9 10 11 12 |
# File 'lib/adrian/rotating_directory_queue.rb', line 9 def initialize( = {}) super @time_format = .fetch(:time_format, '%Y-%m-%d') end |
Instance Attribute Details
#time_format ⇒ Object (readonly)
Returns the value of attribute time_format.
7 8 9 |
# File 'lib/adrian/rotating_directory_queue.rb', line 7 def time_format @time_format end |
Instance Method Details
#available_path ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/adrian/rotating_directory_queue.rb', line 14 def available_path path = "#{super}/#{Time.now.strftime(time_format)}" if path != @previous_avaliable_path FileUtils.mkdir_p(path) @previous_avaliable_path = path end path end |