Class: SimplePubSub::Client::PubSub

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



90
91
92
# File 'lib/simplepubsub.rb', line 90

def message
  @message
end

#procObject (readonly)

Returns the value of attribute proc.



90
91
92
# File 'lib/simplepubsub.rb', line 90

def proc
  @proc
end

#topicObject (readonly)

Returns the value of attribute topic.



90
91
92
# File 'lib/simplepubsub.rb', line 90

def topic
  @topic
end

Instance Method Details

#get(topic, &get_proc) ⇒ Object



92
93
94
95
96
# File 'lib/simplepubsub.rb', line 92

def get(topic, &get_proc)

  @topic = 'subscribe to topic'
  @proc, @message = get_proc, topic
end

#publish(*args) ⇒ Object



98
99
100
101
102
103
104
# File 'lib/simplepubsub.rb', line 98

def publish(*args)

  topic, message = args.length > 1 ? args : args.first.split(':',2)

  @topic, @message = topic, message
  @proc = ->(_,_){}
end