Module: Tavern

Defined in:
lib/tavern.rb,
lib/tavern/hub.rb,
lib/tavern/version.rb,
lib/tavern/mock_hub.rb,
lib/tavern/subscription.rb,
lib/tavern/subscriptions.rb

Defined Under Namespace

Classes: Hub, MockHub, Subscription, Subscriptions

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.hubHub

Gets the current application wide hub, initializing a new one if it hasn’t been set yet.

Returns:

  • (Hub)

    the subscription hub



14
15
16
# File 'lib/tavern/hub.rb', line 14

def hub
  @hub ||= Hub.new.tap { |h| h.primary = true }
end

.hub=(value) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/tavern/hub.rb', line 18

def hub=(value)
  old_hub = @hub
  @hub = value.presence
  if old_hub != @hub
    old_hub.primary = false if old_hub
    @hub.primary    = true  if @hub
  end
end