class Dry::Effects::Effects::Timestamp

Constants

Timestamp

Public Class Methods

new(options = EMPTY_HASH) click to toggle source
Calls superclass method
# File lib/dry/effects/effects/timestamp.rb, line 11
def initialize(options = EMPTY_HASH)
  super()

  module_eval do
    define_method(:timestamp) do |round: Undefined|
      round_to = Undefined.coalesce(round, options.fetch(:round, Undefined))

      if Undefined.equal?(round_to)
        ::Dry::Effects.yield(Timestamp)
      else
        ::Dry::Effects.yield(Timestamp.keywords(round_to: round_to))
      end
    end
  end
end