lib/demiurge.rb
def flush_notifications
      infinite_loop_detector = 0
      # Dispatch the queued notifications. Then, dispatch any
      # notifications that resulted from them.  Then, keep doing that
      # until the queue is empty.
      until @queued_notifications.empty?
        infinite_loop_detector += 1
        if infinite_loop_detector > 20
          raise ::Demiurge::Errors::TooManyNotificationLoopsError.new("Over 20 batches of notifications were dispatched in the same call! Error and die!", "last batch" => @queued_notifications.map { |n| n.class.to_s })
        end

        current_notifications = @queued_notifications
        @queued_notifications = []
        current_notifications.each do |cleaned_data|
          @subscriptions_by_tracker.each do |tracker, sub_structures|
            sub_structures.each do |sub_structure|
              next unless sub_structure[:type] == :all || sub_structure[:type].include?(cleaned_data["type"])
              next unless sub_structure[:zone] == :all || sub_structure[:zone].include?(cleaned_data["zone"])
              next unless sub_structure[:location] == :all || sub_structure[:location].include?(cleaned_data["location"])
              next unless sub_structure[:actor] == :all || sub_structure[:actor].include?(cleaned_data["actor"])
              next unless sub_structure[:predicate] == nil || sub_structure[:predicate] == :all || sub_structure[:predicate].call(cleaned_data)

              sub_structure[:block].call(cleaned_data)
            end
          end
        end
      end
    end
# Send out any pending notifications that have been queued. This
# will normally happen at least once per tick in any case, but may
# happen more often.  If this occurs during the Engine's tick,
# certain ordering issues may occur. Normally it's best to let the
# Engine call this method during the tick, and to only call it
# manually when no tick is occurring.
#
# @return [void]
# @since 0.0.1
Send out any pending notifications that have been queued. This
will normally happen at least once per tick in any case, but may
happen more often.  If this occurs during the Engine's tick,
certain ordering issues may occur. Normally it's best to let the
Engine call this method during the tick, and to only call it
manually when no tick is occurring.
Send out any pending notifications that have been queued . This will normally happen at least once per tick in any case but may happen more often . If this occurs during the Engine ' s tick certain ordering issues may occur . Normally it ' s best to let the Engine call this method during the tick and to only call it manually when no tick is occurring .
def flush_notifications
      infinite_loop_detector = 0
      until @queued_notifications.empty?
        infinite_loop_detector += 1
        if infinite_loop_detector > 20
          raise ::Demiurge::Errors::TooManyNotificationLoopsError.new("Over 20 batches of notifications were dispatched in the same call! Error and die!", "last batch" => @queued_notifications.map { |n| n.class.to_s })
        end
        current_notifications = @queued_notifications
        @queued_notifications = []
        current_notifications.each do |cleaned_data|
          @subscriptions_by_tracker.each do |tracker, sub_structures|
            sub_structures.each do |sub_structure|
              next unless sub_structure[:type] == :all || sub_structure[:type].include?(cleaned_data["type"])
              next unless sub_structure[:zone] == :all || sub_structure[:zone].include?(cleaned_data["zone"])
              next unless sub_structure[:location] == :all || sub_structure[:location].include?(cleaned_data["location"])
              next unless sub_structure[:actor] == :all || sub_structure[:actor].include?(cleaned_data["actor"])
              next unless sub_structure[:predicate] == nil || sub_structure[:predicate] == :all || sub_structure[:predicate].call(cleaned_data)
              sub_structure[:block].call(cleaned_data)
            end
          end
        end
      end
    end
def flush_notifications infinite_loop_detector = 0 until @queued_notifications . empty? infinite_loop_detector += 1 if infinite_loop_detector > 20 raise :: Demiurge :: Errors :: TooManyNotificationLoopsError . new ( "Over 20 batches of notifications were dispatched in the same call! Error and die!" , "last batch" => @queued_notifications . map { | n | n . class . to_s } ) end current_notifications = @queued_notifications @queued_notifications = [ ] current_notifications . each do | cleaned_data | @subscriptions_by_tracker . each do | tracker , sub_structures | sub_structures . each do | sub_structure | next unless sub_structure [ :type ] == :all || sub_structure [ :type ] . include? ( cleaned_data [ "type" ] ) next unless sub_structure [ :zone ] == :all || sub_structure [ :zone ] . include? ( cleaned_data [ "zone" ] ) next unless sub_structure [ :location ] == :all || sub_structure [ :location ] . include? ( cleaned_data [ "location" ] ) next unless sub_structure [ :actor ] == :all || sub_structure [ :actor ] . include? ( cleaned_data [ "actor" ] ) next unless sub_structure [ :predicate ] == nil || sub_structure [ :predicate ] == :all || sub_structure [ :predicate ] . call ( cleaned_data ) sub_structure [ :block ] . call ( cleaned_data ) end end end end end
Send out any pending notifications that have been queued.
Send out any pending notifications that have been queued .
# Dispatch the queued notifications. Then, dispatch any # notifications that resulted from them.  Then, keep doing that # until the queue is empty.
None
void
since
None