Class: Vayacondios::Notifier

Inherits:
Vayacondios show all
Defined in:
lib/vayacondios/client/notifier.rb

Constant Summary

Constants inherited from Vayacondios

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Vayacondios

default_notifier, force_legacy_mode, legacy_switch

Methods included from Notifications

included

Instance Attribute Details

#clientObject

Returns the value of attribute client.



6
7
8
# File 'lib/vayacondios/client/notifier.rb', line 6

def client
  @client
end

Instance Method Details

#notify(topic, cargo = {}) ⇒ Object



18
19
20
# File 'lib/vayacondios/client/notifier.rb', line 18

def notify(topic, cargo = {})
  NoMethodError.unimplemented_method(self)
end

#prepare(obj) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/vayacondios/client/notifier.rb', line 8

def prepare(obj)
  case
  when obj.respond_to?(:to_inspectable) then obj.to_inspectable
  when obj.respond_to?(:to_wire)        then obj.to_wire
  when obj.respond_to?(:to_hash)        then obj.to_hash
  else
    raise ArgumentError.new("Cannot notify '#{obj.inspect}' -- require a hash-like object.")
  end
end