lib/scrivito/user.rb in scrivito_sdk-1.2.0 vs lib/scrivito/user.rb in scrivito_sdk-1.3.0.rc1

- old
+ new

@@ -136,11 +136,12 @@ @explicit_rules = options[:explicit_rules] @description_proc = options[:description_proc] @suggest_users_proc = options[:suggest_users_proc] @restriction_set = options[:restriction_set] - @explicit_rules.each_key { |rule| assert_valid_verb(rule.second) } + @explicit_rules.each { |rule| assert_valid_verb(rule.second) } + @explicit_rules_set = Set.new(@explicit_rules.map { |rule| rule.take(3) }) end def can?(verb, workspace) assert_valid_verb(verb) @@ -154,15 +155,15 @@ end end def can_always?(verb, subject) assert_valid_verb(verb) - @explicit_rules.has_key?([:can_always, verb, subject]) + @explicit_rules_set.include?([:always, verb, subject]) end def can_never?(verb, subject) assert_valid_verb(verb) - @explicit_rules.has_key?([:can_never, verb, subject]) + @explicit_rules_set.include?([:never, verb, subject]) end def owner_of?(workspace) membership = workspace.memberships[self] membership ? membership.role == 'owner' : false