Sha256: ec7b9a5ac56de92ab91ae40b008a14e6e644165894bcd93e79a3bf53c68b70a2

Contents?: true

Size: 510 Bytes

Versions: 1

Compression:

Stored size: 510 Bytes

Contents

= Expirable

Require the library.

  require 'mixers/expirable'

Example class.

  class X
    extend Expirable
  end

Now the experation can be set to a Time object, or a number of seconds
from +Time.now+. For instance, to set the expiration for one second
from now.

  X.expiration = 1

We can see the the object has not yet expired.

  X.refute.expired?

But if we wait one seconds.

  sleep 1

Then it will have expired.

  X.assert.expired?

Expiration does not invoke a trigger, it is merely queriable.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mixers-1.2.0 qed/06_expirable.rdoc