lib/presence/listeners/logger.rb
# Always log events, even if there is no explicit handler. Generate a
# method at runtime so we don't have to do method_missing every time.
Always log events, even if there is no explicit handler. Generate a
method at runtime so we don't have to do method_missing every time.
Always log events even if there is no explicit handler . Generate a method at runtime so we don ' t have to do method_missing every time .
def method_missing(method_sym, *arguments, &block)
      arg_names = arguments.each_with_index.map { |arg, i| "arg#{i}" }
      arg_list = arg_names.join(',')
      instance_eval <<-RUBY
        def #{method_sym}(#{arg_list})
          log_unknown_event(:#{method_sym}, #{arg_list})
        end
      RUBY
      send(method_sym, *arguments)
    end
def method_missing ( method_sym , * arguments , & block ) arg_names = arguments . each_with_index . map { | arg , i | "arg#{i}" } arg_list = arg_names . join ( ',' ) instance_eval <<-RUBY 
        def  #{ method_sym } ( #{ arg_list } )
          log_unknown_event(: #{ method_sym } ,  #{ arg_list } )
        end
       RUBY send ( method_sym , * arguments ) end
Always log events, even if there is no explicit handler.
Always log events even if there is no explicit handler .
# def method_sym(arg1, arg2, ...) #   log_unknown_event(:method_sym, arg1, arg2, ...) # end
method_sym
<not_specific>
arguments
<not_specific>
block
<not_specific>