Class: SSCBot::ChatLog::Observer

Inherits:
Object
  • Object
show all
Defined in:
lib/ssc.bot/chat_log.rb

Overview

Author:

  • Jonathan Bradley Whited

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, *funcs) ⇒ Observer

Returns a new instance of Observer.

Raises:

  • (ArgumentError)

Since:

  • 0.1.0



243
244
245
246
247
248
249
250
# File 'lib/ssc.bot/chat_log.rb', line 243

def initialize(object,*funcs)
  super()

  raise ArgumentError,'empty funcs' if funcs.empty?

  @funcs = funcs
  @object = object
end

Instance Attribute Details

#funcsObject (readonly)

Since:

  • 0.1.0



240
241
242
# File 'lib/ssc.bot/chat_log.rb', line 240

def funcs
  @funcs
end

#objectObject (readonly)

Since:

  • 0.1.0



241
242
243
# File 'lib/ssc.bot/chat_log.rb', line 241

def object
  @object
end

Instance Method Details

#notify(chat_log, message) ⇒ Object

Since:

  • 0.1.0



252
253
254
255
256
# File 'lib/ssc.bot/chat_log.rb', line 252

def notify(chat_log,message)
  @funcs.each do |func|
    @object.__send__(func,chat_log,message)
  end
end