lib/circuitbox/memory_store/container.rb in circuitbox-2.0.0.pre3 vs lib/circuitbox/memory_store/container.rb in circuitbox-2.0.0.pre4
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require_relative 'monotonic_time'
class Circuitbox
class MemoryStore
class Container
@@ -11,14 +13,14 @@
@value = value
expires_after(expiry)
end
def expired?
- @expires_after > 0 && @expires_after < current_second
+ @expires_after.positive? && @expires_after < current_second
end
def expired_at?(clock_second)
- @expires_after > 0 && @expires_after < clock_second
+ @expires_after.positive? && @expires_after < clock_second
end
def expires_after(seconds = 0)
@expires_after = seconds.zero? ? seconds : current_second + seconds
end