Class: BenchBloc::Logger::RubyProf
Instance Attribute Summary
#results, #title
Instance Method Summary
collapse
#initialize
Instance Method Details
#log_results ⇒ Object
4
5
6
7
8
9
|
# File 'lib/bench_bloc/logger/ruby_prof.rb', line 4
def log_results
formatted_results = BenchBloc::Formatter::RubyProf
.new(results, title)
.format_results
write_to_log formatted_results
end
|
#write_to_log(results) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/bench_bloc/logger/ruby_prof.rb', line 11
def write_to_log results
if defined?(Rails)
printer = ::RubyProf::FlatPrinter.new(results)
File.open("#{Rails.root}/log/bench_bloc_ruby-prof.log", 'w') { |file|
printer.print(file)
}
else
printer = ::RubyProf::FlatPrinter.new(results)
File.open("log/bench_bloc_ruby-prof.log", "w") { |file|
printer.print(file)
}
end
end
|