Class: Conveyor::Output::Channel

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/conveyor/output/channel.rb

Instance Method Summary collapse

Constructor Details

#initializeChannel

Returns a new instance of Channel.



6
7
# File 'lib/conveyor/output/channel.rb', line 6

def initialize
end

Instance Method Details

#write(name, msgtype, *msg) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/conveyor/output/channel.rb', line 9

def write(name, msgtype, *msg)
  @channel = Conveyor::Foreman.instance.channel
  return false if @channel.nil?

  options = msg.extract_options!
  format = '[%s] [%s::%s] %s'

  Array.new(msg).each do |m|
    @channel.push [msgtype, sprintf(format, Time.now, name, msgtype, m)]
  end
end