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

Instance Method Details

#buffer(&block) ⇒ Object



34
35
36
# File 'lib/gamefic/active/messaging.rb', line 34

def buffer &block
  messenger.buffer(&block)
end

#flushObject



38
39
40
# File 'lib/gamefic/active/messaging.rb', line 38

def flush
  messenger.flush
end

#messagesObject



30
31
32
# File 'lib/gamefic/active/messaging.rb', line 30

def messages
  messenger.messages
end

#messengerObject



7
8
9
# File 'lib/gamefic/active/messaging.rb', line 7

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.

Parameters:



26
27
28
# File 'lib/gamefic/active/messaging.rb', line 26

def stream(message)
  messenger.stream message
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.

Parameters:



17
18
19
# File 'lib/gamefic/active/messaging.rb', line 17

def tell(message)
  messenger.tell message
end