Module: Card::Log::Performance::BigBrother

Defined in:
lib/card/log.rb

Instance Method Summary collapse

Instance Method Details

#watch_all_instance_methodsObject



378
379
380
# File 'lib/card/log.rb', line 378

def watch_all_instance_methods
  watch_instance_method *instance_methods
end

#watch_all_methodsObject



387
388
389
390
# File 'lib/card/log.rb', line 387

def watch_all_methods
  watch_all_instance_methods
  watch_all_singleton_methods
end

#watch_all_singleton_methodsObject



382
383
384
385
# File 'lib/card/log.rb', line 382

def watch_all_singleton_methods
  fragile_methods = [:default_scope, :default_scopes, :default_scopes=]  # if I touch these methods ActiveRecord breaks
  watch_singleton_method *(singleton_methods - fragile_methods)
end

#watch_instance_method(*names) ⇒ Object



366
367
368
369
370
# File 'lib/card/log.rb', line 366

def watch_instance_method *names
  names.each do |name|
    watch_method name, :instance
  end
end

#watch_method(method_name, method_type = :all, options = {}) ⇒ Object



353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/card/log.rb', line 353

def watch_method method_name, method_type=:all, options={}
  Card::Log::Performance.enable_method method_name

  if !SPECIAL_METHODS.include? method_name
    if method_type == :all || method_type == :singleton
      add_singleton_logging method_name, options
    end
    if method_type == :all || method_type == :instance
      add_instance_logging method_name, options
    end
  end
end

#watch_singleton_method(*names) ⇒ Object



372
373
374
375
376
# File 'lib/card/log.rb', line 372

def watch_singleton_method *names
  names.each do |name|
    watch_method name, :singleton
  end
end