Module: Gamefic::Messaging
- Included in:
- Entity
- Defined in:
- lib/gamefic/messaging.rb
Instance Method Summary collapse
- #flush ⇒ Object
- #messages ⇒ String
- #output ⇒ Object
-
#stream(message) ⇒ Object
Send a message to the Character as raw text.
-
#tell(message) ⇒ Object
Send a message to the entity.
Instance Method Details
#flush ⇒ Object
34 35 36 |
# File 'lib/gamefic/messaging.rb', line 34 def flush '' unless .empty? end |
#output ⇒ Object
30 31 32 |
# File 'lib/gamefic/messaging.rb', line 30 def output end |
#stream(message) ⇒ Object
Send a message to the Character as raw text. Unlike #tell, this method will not wrap the message in HTML paragraphs.
21 22 23 |
# File 'lib/gamefic/messaging.rb', line 21 def stream() + .strip 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.
8 9 10 11 12 13 14 15 |
# File 'lib/gamefic/messaging.rb', line 8 def tell() = "<p>#{message.strip}</p>" # This method uses String#gsub instead of String#gsub! for # compatibility with Opal. = .gsub(/[ \t\r]*\n[ \t\r]*\n[ \t\r]*/, '</p><p>') = .gsub(/[ \t]*\n[ \t]*/, ' ') + end |