Module: Gamefic::Active::Messaging
- Included in:
- Gamefic::Active
- Defined in:
- lib/gamefic/active/messaging.rb
Overview
A module for active entities that provides a default Messenger with a few shortcuts.
Instance Method Summary collapse
- #buffer(&block) ⇒ Object
- #flush ⇒ Object
- #messages ⇒ Object
- #messenger ⇒ Object
-
#stream(message) ⇒ Object
Send a message to the entity as raw text.
-
#tell(message) ⇒ Object
Send a message to the entity.
Instance Method Details
#buffer(&block) ⇒ Object
36 37 38 |
# File 'lib/gamefic/active/messaging.rb', line 36 def buffer &block messenger.buffer(&block) end |
#flush ⇒ Object
40 41 42 |
# File 'lib/gamefic/active/messaging.rb', line 40 def flush messenger.flush end |
#messages ⇒ Object
32 33 34 |
# File 'lib/gamefic/active/messaging.rb', line 32 def messenger. end |
#messenger ⇒ Object
9 10 11 |
# File 'lib/gamefic/active/messaging.rb', line 9 def messenger @messenger ||= Messenger.new end |
#stream(message) ⇒ Object
Send a message to the entity as raw text.
Unlike #tell, this method will not wrap the message in HTML paragraphs.
28 29 30 |
# File 'lib/gamefic/active/messaging.rb', line 28 def stream() messenger.stream end |
#tell(message) ⇒ Object
Send a message to the entity.
This method will automatically wrap the message in HTML paragraphs. To send a message without paragraph formatting, use #stream instead.
19 20 21 |
# File 'lib/gamefic/active/messaging.rb', line 19 def tell() messenger.tell end |