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

Defined in:
lib/card/log.rb

Instance Method Summary collapse

Instance Method Details

#watch_all_instance_methodsObject



473
474
475
# File 'lib/card/log.rb', line 473

def watch_all_instance_methods
  watch_instance_method *instance_methods
end

#watch_all_methodsObject



482
483
484
485
# File 'lib/card/log.rb', line 482

def watch_all_methods
  watch_all_instance_methods
  watch_all_singleton_methods
end

#watch_all_singleton_methodsObject



477
478
479
480
# File 'lib/card/log.rb', line 477

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



461
462
463
464
465
# File 'lib/card/log.rb', line 461

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

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



448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/card/log.rb', line 448

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



467
468
469
470
471
# File 'lib/card/log.rb', line 467

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