Sha256: beb817be34d5efb50c69bf87a1beade9bfced39774f6a5dffff08f5efc32cd77
Contents?: true
Size: 405 Bytes
Versions: 1
Compression:
Stored size: 405 Bytes
Contents
module Roadblock module Authorizer def initialize(user, scopes: []) self.user = user self.scopes = scopes end def can?(action, object) if block_given? yield(object) else objects = [*object] objects .map { |obj| send("can_#{action}?", obj) } .all? end end private attr_accessor :user, :scopes end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
roadblock-0.1.0 | lib/roadblock/authorizer.rb |