Class: PgNotifier::Subscription

Inherits:
Object
  • Object
show all
Defined in:
lib/pg_notifier/subscription.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel, options, &block) ⇒ Subscription

Returns a new instance of Subscription.



5
6
7
8
9
# File 'lib/pg_notifier/subscription.rb', line 5

def initialize(channel, options, &block)
  @channel = channel
  @options = options
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



3
4
5
# File 'lib/pg_notifier/subscription.rb', line 3

def block
  @block
end

#channelObject (readonly)

Returns the value of attribute channel.



3
4
5
# File 'lib/pg_notifier/subscription.rb', line 3

def channel
  @channel
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/pg_notifier/subscription.rb', line 3

def options
  @options
end

Instance Method Details

#notify(channel, pid, payload) ⇒ Object



11
12
13
# File 'lib/pg_notifier/subscription.rb', line 11

def notify(channel, pid, payload)
  block.call [channel, pid, payload]
end