Sha256: b0d4a084b843e2940daa40bd2cca26c55a37a11f2268d93c841bc1b6fdbe96b0
Contents?: true
Size: 919 Bytes
Versions: 6
Compression:
Stored size: 919 Bytes
Contents
require 'benchmark/ips' require 'access-granted' require 'cancan' require_relative './config' admin = User.new(true, false) mod = User.new(false, true) user = User.new(false, false) user_policy = AccessPolicy.new(user) admin_policy = AccessPolicy.new(admin) mod_policy = AccessPolicy.new(mod) user_ability = Ability.new(user) admin_ability = Ability.new(admin) mod_ability = Ability.new(mod) Benchmark.ips do |x| x.config(time: 20, warmup: 2) x.report("ag-admin") do admin_policy.can?(:read, String) end x.report("ag-moderator") do mod_policy.can?(:read, String) end x.report("ag-user") do user_policy.can?(:read, String) end x.report("cancan-admin") do admin_ability.can?(:read, String) end x.report("cancan-moderator") do mod_ability.can?(:read, String) end x.report("cancan-user") do user_ability.can?(:read, String) end end
Version data entries
6 entries across 6 versions & 1 rubygems