Class: Riot::Message

Inherits:
BlankSlate show all
Defined in:
lib/riot/message.rb

Instance Method Summary collapse

Constructor Details

#initialize(*phrases) ⇒ Message

Returns a new instance of Message.



7
8
9
# File 'lib/riot/message.rb', line 7

def initialize(*phrases)
  @chunks = []; _inspect(phrases)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *phrases, &blk) ⇒ Object



13
# File 'lib/riot/message.rb', line 13

def method_missing(meth, *phrases, &blk) push(meth.to_s.gsub('_', ' ')); _inspect(phrases); end

Instance Method Details

#but(*phrases) ⇒ Object



16
# File 'lib/riot/message.rb', line 16

def but(*phrases); comma("but", *phrases); end

#comma(str, *phrases) ⇒ Object



15
# File 'lib/riot/message.rb', line 15

def comma(str, *phrases) _concat([", ", str]); _inspect(phrases); end

#not(*phrases) ⇒ Object



17
# File 'lib/riot/message.rb', line 17

def not(*phrases); comma("not", *phrases); end

#push(str) ⇒ Object



18
# File 'lib/riot/message.rb', line 18

def push(str) _concat([" ", str]); end

#to_sObject



11
# File 'lib/riot/message.rb', line 11

def to_s; @chunks.join.strip; end