Class: PgEventstore::Web::Subscriptions::WithState::Subscriptions

Inherits:
Object
  • Object
show all
Defined in:
lib/pg_eventstore/web/subscriptions/with_state/subscriptions.rb,
sig/pg_eventstore/web/subscriptions/with_state/subscriptions.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, current_set, state:) ⇒ Subscriptions

Returns a new instance of Subscriptions.

Parameters:



16
17
18
19
20
# File 'lib/pg_eventstore/web/subscriptions/with_state/subscriptions.rb', line 16

def initialize(connection, current_set, state:)
  @connection = connection
  @current_set = current_set
  @state = state
end

Instance Attribute Details

#connectionPgEventstore::Connection

Returns the value of attribute connection.



10
11
12
# File 'lib/pg_eventstore/web/subscriptions/with_state/subscriptions.rb', line 10

def connection
  @connection
end

Instance Method Details

#subscription_queriesPgEventstore::SubscriptionQueries

Returns:

  • (PgEventstore::SubscriptionQueries)


32
33
34
# File 'lib/pg_eventstore/web/subscriptions/with_state/subscriptions.rb', line 32

def subscription_queries
  SubscriptionQueries.new(connection, QueryStrategy::Foreground.new(connection))
end

#subscriptionsArray<PgEventstore::Subscription>

Returns:



23
24
25
26
27
# File 'lib/pg_eventstore/web/subscriptions/with_state/subscriptions.rb', line 23

def subscriptions
  @subscriptions ||= subscription_queries.find_all(set: @current_set, state: @state).map do |attrs|
    Subscription.new(**attrs)
  end
end