module Athena::Clock::Aware

Overview

This module can be included to make a type time aware without having to alter its constructor.

class Example
  include Athena::Clock::Aware

  def expired?
    self.now > some_time_instance
  end
end

# Will use a `Athena::Clock` instance if a custom one is not set on the instance.
example = Example.new

# Or if so desired, explicitly set custom implementation.
my_clock = MySpecialClock.new
custom_example = Example.new
custom_example.clock = my_clock

Defined in:

aware.cr

Instance Method Summary

Instance Method Detail

def clock=(clock : ACLK::Interface | Nil) #

[View source]
def now : Time #

[View source]