Class: SSCBot::Clu

Inherits:
Object
  • Object
show all
Includes:
Forwardable
Defined in:
lib/ssc.bot/clu.rb

Overview

Chat Log + User

Author:

  • Jonathan Bradley Whited

Since:

  • 0.1.2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chat_log, msg_sender) ⇒ Clu

Returns a new instance of Clu.

Since:

  • 0.1.2



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ssc.bot/clu.rb', line 31

def initialize(chat_log,msg_sender)
  super()

  @bots = {}
  @chat_log = chat_log
  @msg_sender = msg_sender

  def_delegators(:@bots,:[])
  def_delegator(:@bots,:key?,:bot?)
  def_delegators(:@chat_log,*(@chat_log.public_methods - public_methods))
  def_delegators(:@msg_sender,*(@msg_sender.public_methods - public_methods))
end

Instance Attribute Details

#botsObject (readonly)

Since:

  • 0.1.2



27
28
29
# File 'lib/ssc.bot/clu.rb', line 27

def bots
  @bots
end

#chat_logObject (readonly)

Since:

  • 0.1.2



28
29
30
# File 'lib/ssc.bot/clu.rb', line 28

def chat_log
  @chat_log
end

#msg_senderObject (readonly)

Since:

  • 0.1.2



29
30
31
# File 'lib/ssc.bot/clu.rb', line 29

def msg_sender
  @msg_sender
end

Instance Method Details

#add_bot(bot_class) ⇒ Object

Since:

  • 0.1.2



44
45
46
47
48
49
50
51
52
53
# File 'lib/ssc.bot/clu.rb', line 44

def add_bot(bot_class)
  bot = @bots[bot_class]

  if bot.nil?
    bot = bot_class.new(self)
    @bots[bot_class] = bot
  end

  return bot
end