Class: ProMonitor
- Inherits:
-
Object
show all
- Defined in:
- lib/pro_monitor.rb
Defined Under Namespace
Classes: Aggregation, Change, Config, Observer, Publisher
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.aggregate_and_publish ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/pro_monitor.rb', line 24
def self.aggregate_and_publish
aggregation = aggregate_changes do
yield
end
publish_changes(aggregation)
aggregation
end
|
.aggregate_changes(options = {}) ⇒ Object
class_attribute :current_aggregation
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/pro_monitor.rb', line 9
def self.aggregate_changes(options = {})
previous_aggregation = self.current_aggregation
self.current_aggregation = aggregation = ProMonitor::Aggregation.new
begin
yield
ensure
self.current_aggregation = previous_aggregation
end
aggregation
end
|
.config ⇒ Object
36
37
38
|
# File 'lib/pro_monitor.rb', line 36
def self.config
@config ||= ProMonitor::Config.new
end
|
40
41
42
|
# File 'lib/pro_monitor.rb', line 40
def self.configure
yield(self.config) if block_given?
end
|
.logger ⇒ Object
44
45
46
|
# File 'lib/pro_monitor.rb', line 44
def self.logger
Rails.logger
end
|
.publish_changes(aggregation) ⇒ Object
Instance Method Details
#aggregating? ⇒ Boolean
32
33
34
|
# File 'lib/pro_monitor.rb', line 32
def aggregating?
!!current_aggregation
end
|