Sha256: de49352da9d2171116dedfbb25a4aa8c5d14b75be3ac4de56c64f177617e5878
Contents?: true
Size: 596 Bytes
Versions: 1
Compression:
Stored size: 596 Bytes
Contents
require 'say_when/triggers/base' module SayWhen module Triggers class OnceStrategy include SayWhen::Triggers::Base attr_accessor :once_at def initialize(options=nil) options ||= Time.now # if it's a hash, pull out the time @once_at = if options.is_a?(Time) || options.acts_like_time? options elsif options.is_a?(Hash) && options[:at] options[:at] else Time.now end end def next_fire_at(time=Time.now) once_at if once_at >= time end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
say_when-0.1.0 | lib/say_when/triggers/once_strategy.rb |