Class: LogStash::Outputs::Qingstor::RotationPolicy::Time
- Defined in:
- lib/logstash/outputs/qingstor/rotation_policy.rb
Instance Method Summary collapse
-
#initialize(_, file_time) ⇒ Time
constructor
A new instance of Time.
- #rotate?(file) ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from Policy
#name, #needs_periodic?, #positive_check
Constructor Details
#initialize(_, file_time) ⇒ Time
Returns a new instance of Time.
27 28 29 30 |
# File 'lib/logstash/outputs/qingstor/rotation_policy.rb', line 27 def initialize(_, file_time) @file_time = file_time positive_check(@file_time) end |
Instance Method Details
#rotate?(file) ⇒ Boolean
32 33 34 |
# File 'lib/logstash/outputs/qingstor/rotation_policy.rb', line 32 def rotate?(file) !file.empty? && (::Time.now - file.ctime) >= @file_time end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/logstash/outputs/qingstor/rotation_policy.rb', line 36 def to_s { :policy => name, :file_time => @file_time }.to_s end |