Class: Igniter::Extensions::Contracts::Reactive::Subscription

Inherits:
Object
  • Object
show all
Defined in:
lib/igniter/extensions/contracts/reactive/subscription.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_type:, action:, path: nil, once_per_dispatch: false) ⇒ Subscription

Returns a new instance of Subscription.



10
11
12
13
14
15
16
# File 'lib/igniter/extensions/contracts/reactive/subscription.rb', line 10

def initialize(event_type:, action:, path: nil, once_per_dispatch: false)
  @event_type = event_type.to_sym
  @path = path&.to_sym
  @action = action
  @once_per_dispatch = once_per_dispatch
  freeze
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



8
9
10
# File 'lib/igniter/extensions/contracts/reactive/subscription.rb', line 8

def action
  @action
end

#event_typeObject (readonly)

Returns the value of attribute event_type.



8
9
10
# File 'lib/igniter/extensions/contracts/reactive/subscription.rb', line 8

def event_type
  @event_type
end

#once_per_dispatchObject (readonly)

Returns the value of attribute once_per_dispatch.



8
9
10
# File 'lib/igniter/extensions/contracts/reactive/subscription.rb', line 8

def once_per_dispatch
  @once_per_dispatch
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/igniter/extensions/contracts/reactive/subscription.rb', line 8

def path
  @path
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
24
# File 'lib/igniter/extensions/contracts/reactive/subscription.rb', line 18

def to_h
  {
    event_type: event_type,
    path: path,
    once_per_dispatch: once_per_dispatch
  }
end