Sha256: f7580f4a8604b26c1efc63d42eb2e264fa29e3d538b6975aa3bca7f44ebff5c8

Contents?: true

Size: 805 Bytes

Versions: 3

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true

require_relative 'redis_record'

module Hyperstack
  module ConnectionAdapter
    module Redis
      class QueuedMessage < RedisRecord::Base
        self.table_name = 'hyperstack:queued_messages'
        self.column_names = %w[id data connection_id].freeze

        attr_accessor(*column_names.map(&:to_sym))

        class << self
          def for_session(session)
            Connection.where(session: session).map(&:messages).flatten
          end

          def root_path=(path)
            find_or_create_by(connection_id: 0).update(data: path)
          end

          def root_path
            find_or_create_by(connection_id: 0).data
          end
        end

        def connection
          Connection.find(connection_id)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hyper-operation-1.0.alpha1.8 lib/hyper-operation/transport/connection_adapter/redis/queued_message.rb
hyper-operation-1.0.alpha1.7 lib/hyper-operation/transport/connection_adapter/redis/queued_message.rb
hyper-operation-1.0.alpha1.6 lib/hyper-operation/transport/connection_adapter/redis/queued_message.rb