lib/dry/events/event.rb in dry-events-0.3.0 vs lib/dry/events/event.rb in dry-events-0.4.0

- old
+ new

@@ -1,9 +1,8 @@ # frozen_string_literal: true -require 'dry/core/equalizer' -require 'dry/events/constants' +require "dry/events/constants" module Dry module Events # Event object # @@ -12,25 +11,25 @@ include Dry::Equalizer(:id, :payload) InvalidEventNameError = Class.new(StandardError) do # @api private def initialize - super('please provide a valid event name, it could be either String or Symbol') + super("please provide a valid event name, it could be either String or Symbol") end end - DOT = '.'.freeze - UNDERSCORE = '_'.freeze + DOT = "." + UNDERSCORE = "_" # @!attribute [r] id # @return [Symbol, String] The event identifier attr_reader :id # @api private def self.new(id, payload = EMPTY_HASH) return super(id, payload) if (id.is_a?(String) || id.is_a?(Symbol)) && !id.empty? - raise InvalidEventNameError.new + raise InvalidEventNameError end # Initialize a new event # # @param [Symbol, String] id The event identifier