Sha256: 4860cb4606532eaa666d7bc6675d5e9426d65d74c95934fa52dcbdb0e1482f16

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module SiteMaps
  module Notification
    Error = Class.new(SiteMaps::Error)

    class UnregisteredEventError < Error
      def initialize(object_or_event_id)
        case object_or_event_id
        when String, Symbol
          super("You are trying to publish an unregistered event: `#{object_or_event_id}`")
        else
          super("You are trying to publish an unregistered event")
        end
      end
    end

    class InvalidSubscriberError < Error
      def initialize(object_or_event_id)
        case object_or_event_id
        when String, Symbol
          super("you are trying to subscribe to an event: `#{object_or_event_id}` that has not been registered")
        else
          super("you try use subscriber object that will never be executed")
        end
      end
    end

    include Publisher

    register_event "sitemaps.finalize_urlset"
    register_event "sitemaps.before_process_execution"
    register_event "sitemaps.enqueue_process"
    register_event "sitemaps.process_execution"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
site_maps-0.0.1.beta3 lib/site_maps/notification.rb
site_maps-0.0.1.beta2 lib/site_maps/notification.rb