Sha256: de797aeebb5bed03c575ac03a46b65ae1d6bfd5ec40becc84aa0a44f6e782e08
Contents?: true
Size: 854 Bytes
Versions: 1
Compression:
Stored size: 854 Bytes
Contents
# frozen_string_literal: true require_relative "base" module Moleculer module Packets ## # Represents a EVENT packet class Event < Base attr_reader :event, :data, :broadcast, :groups def initialize(config, data = {}) super(config, data) @event = HashUtil.fetch(data, :event) @data = HashUtil.fetch(data, :data) @broadcast = HashUtil.fetch(data, :broadcast) @groups = HashUtil.fetch(data, :groups, []) @node = HashUtil.fetch(data, :node, nil) end def to_h super.merge( event: @event, data: @data, broadcast: @broadcast, groups: @groups, ) end def topic "#{super}.#{@node.id}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
moleculer-0.3.0 | lib/moleculer/packets/event.rb |