Class: Toast::TestChannel

Inherits:
Channel
  • Object
show all
Defined in:
lib/test_channel.rb

Instance Attribute Summary collapse

Attributes inherited from Channel

#responder_class, #responders

Instance Method Summary collapse

Methods inherited from Channel

#handle, #next_msg, #responder_for

Constructor Details

#initialize(responder_class) ⇒ TestChannel

Returns a new instance of TestChannel.



5
6
7
8
# File 'lib/test_channel.rb', line 5

def initialize responder_class
  super responder_class
  self.output=[]
end

Instance Attribute Details

#outputObject

Returns the value of attribute output.



3
4
5
# File 'lib/test_channel.rb', line 3

def output
  @output
end

Instance Method Details

#run(script) ⇒ Object



14
15
16
17
18
# File 'lib/test_channel.rb', line 14

def run script
  script.each do |text|
    handle Message.new(text,'test@localhost')
  end
end

#send(msg, to) ⇒ Object



10
11
12
# File 'lib/test_channel.rb', line 10

def send msg,to
  @output << Message.new(msg,to)
end