module Eco module API module Common module Session class Logger module Channels CHANNELS = %i[general].freeze class << self def included(base) super base.extend ClassMethods end end module ClassMethods def channels!(&def_block) str = "Block with channel implementation expected. None given." raise ArgumentError, str unless block_given? channels.each do |channel| meth = channel.to_s.downcase.to_sym define_method(meth) do |msg = nil, &block| def_block.call(meth, msg, &block) end end end private def channels self::CHANNELS end end end end end end end end