Class: CelluloidIOPGListener::Examples::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/celluloid-io-pg-listener/examples/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(optional_arg = nil, *options) ⇒ Client

Defining initialize is optional,

unless you have custom args you need to handle
aside from those used by the CelluloidIOPGListener::Client

But if you do define it, use a splat,

hash or array splat should work,
depending on your signature needs.

With either splat, only pass the splat params to super,

and handle all your custom params locally.


17
18
19
# File 'lib/celluloid-io-pg-listener/examples/client.rb', line 17

def initialize(optional_arg = nil, *options)
  @optional_arg = optional_arg # handle it here, don't pass it on!
end

Instance Attribute Details

#optional_argObject (readonly)

Returns the value of attribute optional_arg.



7
8
9
# File 'lib/celluloid-io-pg-listener/examples/client.rb', line 7

def optional_arg
  @optional_arg
end

Instance Method Details

#insert_callback(channel, payload) ⇒ Object



21
22
23
24
25
# File 'lib/celluloid-io-pg-listener/examples/client.rb', line 21

def insert_callback(channel, payload)
  # <-- within the unlisten_wrapper's block if :insert_callback is the callback_method
  debug "#{self.class} channel is #{channel}"
  debug "#{self.class} payload is #{payload}"
end