Module: FactoryBotProfile
- Defined in:
- lib/factory_bot_profile.rb,
lib/factory_bot_profile/stat.rb,
lib/factory_bot_profile/frame.rb,
lib/factory_bot_profile/stack.rb,
lib/factory_bot_profile/version.rb,
lib/factory_bot_profile/subscriber.rb,
lib/factory_bot_profile/subscription.rb,
lib/factory_bot_profile/aggregate_stats.rb,
lib/factory_bot_profile/report/simple_report.rb
Defined Under Namespace
Modules: Report
Classes: AggregateStats, ChildStat, FactoryStat, Frame, Stack, Stat, Subscriber, Subscription
Constant Summary
collapse
- VERSION =
"0.2.0"
Class Method Summary
collapse
Class Method Details
.merge_and_report(all_stats, reporter: Report::SimpleReport, **options) ⇒ Object
29
30
31
32
|
# File 'lib/factory_bot_profile.rb', line 29
def self.merge_and_report(all_stats, reporter: Report::SimpleReport, **options)
merged_stats = all_stats.reduce(AggregateStats.new, &:merge!)
report(merged_stats, reporter: reporter, **options)
end
|
.report(stats, reporter: Report::SimpleReport, **options) ⇒ Object
25
26
27
|
# File 'lib/factory_bot_profile.rb', line 25
def self.report(stats, reporter: Report::SimpleReport, **options)
reporter.new(stats, **options).deliver if stats
end
|
.reporting ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/factory_bot_profile.rb', line 12
def self.reporting
subscription = subscribe
result = yield
report(subscription.stats)
result
ensure
subscription.unsubscribe
end
|
.subscribe(stats = AggregateStats.new) ⇒ Object