Sha256: 0bbf28cf86a655ef64f3566b314c0498a2c78fb4a4f16f12c32a2904b7151877
Contents?: true
Size: 616 Bytes
Versions: 11
Compression:
Stored size: 616 Bytes
Contents
# frozen_string_literal: true class TableSync::Event attr_reader :event UPSERT_EVENTS = %i[create update].freeze VALID_RESOLVED_EVENTS = %i[update destroy].freeze VALID_RAW_EVENTS = %i[create update destroy].freeze def initialize(event) @event = event validate! end def validate! raise TableSync::EventError.new(event) unless event.in?(VALID_RAW_EVENTS) end def resolve destroy? ? :destroy : :update end def metadata { created: event == :create } end def destroy? event == :destroy end def upsert? event.in?(UPSERT_EVENTS) end end
Version data entries
11 entries across 11 versions & 1 rubygems