Module: Autolog::Methods

Included in:
Object
Defined in:
lib/autolog/methods.rb

Instance Method Summary collapse

Instance Method Details

#autolog(*args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/autolog/methods.rb', line 3

def autolog(*args)
  args.flatten!
  if args.size > 0
    if Autolog.respond_to?(args[0])
      if block_given?
        Autolog.send(args.delete_at(0), args, &Proc.new)
      else
        Autolog.send(args.delete_at(0), args)
      end
    elsif block_given?
      Autolog.events args, &Proc.new
    else
      Autolog.events args
    end
  elsif block_given?
    Autolog.events &Proc.new
  else
    Autolog.events
  end
end