Module: Textus::Manifest::Entry::Validators::Events

Defined in:
lib/textus/manifest/entry/validators/events.rb

Class Method Summary collapse

Class Method Details

.call(entry) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/textus/manifest/entry/validators/events.rb', line 6

def self.call(entry)
  pubsub_events = Textus::Hooks::Registry::EVENTS.select { |_, s| s[:mode] == :pubsub }.keys
  entry.events.each_key do |evt|
    next if pubsub_events.include?(evt.to_sym)

    raise UsageError.new(
      "entry '#{entry.key}': unknown event '#{evt}' in events: block. " \
      "Known events: #{pubsub_events.join(", ")}.",
    )
  end
end