Class: Timeasure::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/timeasure/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/timeasure/configuration.rb', line 6

def initialize
  @post_measuring_proc = lambda do |measurement|
    # Enables the configuration of what to do with each method runtime measurement.
    # By default it reports to Timeasure's Profiling Manager.

    Timeasure::Profiling::Manager.report(measurement)
  end

  @rescue_proc = lambda do |e, klass|
    # Enabled the configuration of post_measuring_proc rescue.
  end

  @enable_timeasure_proc = lambda do
    # Enables toggling Timeasure's activation (e.g. for disabling Timeasure for RSpec).

    true
  end

  @reported_methods_handler_set_proc = lambda do |reported_methods_handler|
    # Enables configuring where to store the ReportedMethodsHandler instance.
    # This proc will be called by Timeasure::Profiling::Manager.prepare.
    # By default it stores the handler as a class instance variable (in Timeasure::Profiling::Manager)

    @reported_methods_handler = reported_methods_handler
  end

  @reported_methods_handler_get_proc = lambda do
    # Enables configuring where to fetch the ReportedMethodsHandler instance.
    # This proc will be called by Timeasure::Profiling::Manager.report and Timeasure::Profiling::Manager.export.
    # By default it fetches the handler from the class instance variable
    # (see @reported_methods_handler_set_proc).

    @reported_methods_handler
  end
end

Instance Attribute Details

#enable_timeasure_procObject

Returns the value of attribute enable_timeasure_proc.



3
4
5
# File 'lib/timeasure/configuration.rb', line 3

def enable_timeasure_proc
  @enable_timeasure_proc
end

#post_measuring_procObject

Returns the value of attribute post_measuring_proc.



3
4
5
# File 'lib/timeasure/configuration.rb', line 3

def post_measuring_proc
  @post_measuring_proc
end

#reported_methods_handler_get_procObject

Returns the value of attribute reported_methods_handler_get_proc.



3
4
5
# File 'lib/timeasure/configuration.rb', line 3

def reported_methods_handler_get_proc
  @reported_methods_handler_get_proc
end

#reported_methods_handler_set_procObject

Returns the value of attribute reported_methods_handler_set_proc.



3
4
5
# File 'lib/timeasure/configuration.rb', line 3

def reported_methods_handler_set_proc
  @reported_methods_handler_set_proc
end

#rescue_procObject

Returns the value of attribute rescue_proc.



3
4
5
# File 'lib/timeasure/configuration.rb', line 3

def rescue_proc
  @rescue_proc
end