Class: MethodCallLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/method_call_recorder/method_call_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMethodCallLogger

Returns a new instance of MethodCallLogger.



3
4
5
6
# File 'lib/method_call_recorder/method_call_logger.rb', line 3

def initialize
  @recorders = []
  @method_log = []
end

Instance Attribute Details

#method_logObject (readonly)

Returns the value of attribute method_log.



15
16
17
# File 'lib/method_call_recorder/method_call_logger.rb', line 15

def method_log
  @method_log
end

#recordersObject (readonly)

Returns the value of attribute recorders.



15
16
17
# File 'lib/method_call_recorder/method_call_logger.rb', line 15

def recorders
  @recorders
end

Instance Method Details

#register(*rec_objects) ⇒ Object



8
9
10
11
12
13
# File 'lib/method_call_recorder/method_call_logger.rb', line 8

def register(*rec_objects)
  rec_objects.each do |rec|
    rec._on_method_call{|r| method_log << [r, r._last_method] }
    recorders << rec
  end
end