class Andromeda::Kit::Tee

Attributes

delay[RW]
level[RW]

Public Class Methods

new(config = {}) click to toggle source
Calls superclass method
# File lib/andromeda/kit.rb, line 47
def initialize(config = {})
  config = { nick: config } unless config.is_a? Hash || config.is_a?(Spot)
  config = { other: config } unless config.is_a? Hash
  super config

  @level ||= :info
end

Public Instance Methods

initialize_copy(other) click to toggle source
# File lib/andromeda/kit.rb, line 55
def initialize_copy(other)
  @level = other.level.identical_copy
  @delay = other.delay.identical_copy
end
on_enter(key, val) click to toggle source
Calls superclass method
# File lib/andromeda/kit.rb, line 60
def on_enter(key, val)
  log_   = log
  level_ = level
  sleep delay.to_i if delay
  if log_ && level_
    cur_name = current_name
    key_str  = Andromeda::Impl::To_S.short_s key
    val_str  = Andromeda::Impl::To_S.short_s val
    log_str  = "#{to_s}.#{cur_name}(#{key_str}, #{val_str})"
    tags.each_pair { |k, v| log_str << " #{k}=#{Andromeda::Impl::To_S.short_s(v)}" }
    log_str << " tid=0x#{Thread.current.object_id.to_s(16)}"
    log_.send level, log_str
  end
  other_ = other
  other_ << val if other_
  super key, val
end