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

Defined in:
lib/card/log.rb

Instance Method Summary collapse

Instance Method Details

#watch_all_instance_methodsObject



471
472
473
# File 'lib/card/log.rb', line 471

def watch_all_instance_methods
  watch_instance_method *instance_methods
end

#watch_all_methodsObject



480
481
482
483
# File 'lib/card/log.rb', line 480

def watch_all_methods
  watch_all_instance_methods
  watch_all_singleton_methods
end

#watch_all_singleton_methodsObject



475
476
477
478
# File 'lib/card/log.rb', line 475

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



459
460
461
462
463
# File 'lib/card/log.rb', line 459

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

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



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

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



465
466
467
468
469
# File 'lib/card/log.rb', line 465

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