Sha256: d65bfea93c9d84ac2db513006f5587c7d2cc09579111ffa7e65397ce1cbf0d4e

Contents?: true

Size: 490 Bytes

Versions: 3

Compression:

Stored size: 490 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)
        super
        @once_at = options[:at] || Time.now
      end

      def next_fire_at(time=nil)
        nfa = once_at if (!time || (time <= once_at))
        puts "OnceStrategy: next_fire_at: #{nfa}, once_at: #{once_at}, time: #{time}"
        return nfa
      end
      
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
say_when-0.2.3 lib/say_when/triggers/once_strategy.rb
say_when-0.2.1 lib/say_when/triggers/once_strategy.rb
say_when-0.2.0 lib/say_when/triggers/once_strategy.rb