Sha256: 7994f00972c48a17a8f21a3a700b1998b6dac707784eb86189da70434c131ea7
Contents?: true
Size: 783 Bytes
Versions: 8
Compression:
Stored size: 783 Bytes
Contents
require "dry-initializer" require "ruby-prof" require "fileutils" class User extend Dry::Initializer param :first_name, proc(&:to_s), default: proc { "Unknown" } param :second_name, proc(&:to_s), default: proc { "Unknown" } option :email, proc(&:to_s), optional: true option :phone, proc(&:to_s), optional: true end result = RubyProf.profile do 1_000.times { User.new :Andy, email: :"andy@example.com" } end FileUtils.mkdir_p "./tmp" FileUtils.touch "./tmp/profile.dot" File.open("./tmp/profile.dot", "w+") do |output| RubyProf::DotPrinter.new(result).print(output, min_percent: 0) end FileUtils.touch "./tmp/profile.html" File.open("./tmp/profile.html", "w+") do |output| RubyProf::CallStackPrinter.new(result).print(output, min_percent: 0) end
Version data entries
8 entries across 8 versions & 1 rubygems