Class: Rodbot::Relay
Overview
Base class for relay extensions
Direct Known Subclasses
Class Method Summary collapse
-
.say(text, on: nil, room: nil) ⇒ Boolean
Post a message via one or more relay services.
Instance Method Summary collapse
-
#loops ⇒ Array<Proc>
abstract
Loops which will be called by the relay service.
Methods included from Memoize
Class Method Details
.say(text, on: nil, room: nil) ⇒ Boolean
Post a message via one or more relay services
By default, messages are posted via all relay services which have “say true” configured in their corresponding config blocks. To further narrow it to exactly one relay service, use the on
argument.
26 27 28 29 30 31 32 |
# File 'lib/rodbot/relay.rb', line 26 def say(text, on: nil, room: nil) Rodbot.config(:plugin).select do |extension, config| config[:say] == true && (!on || extension == on) end.keys.inject(true) do |success, extension| write(Rodbot::Message.new(text, room: room).dump, extension) && success end end |
Instance Method Details
#loops ⇒ Array<Proc>
This method is abstract.
Loops which will be called by the relay service
58 59 60 |
# File 'lib/rodbot/relay.rb', line 58 def loops fail(Rodbot::RelayError, "loops method is not implemented") end |