lib/authority/authorizer.rb in authority-0.0.1 vs lib/authority/authorizer.rb in authority-0.2.0

- old
+ new

@@ -5,21 +5,21 @@ def initialize(resource) @resource = resource end - ADJECTIVES.each do |adjective| + Authority.adjectives.each do |adjective| class_eval <<-RUBY, __FILE__, __LINE__ + 1 - def self.#{adjective}_by?(actor) - false + def self.#{adjective}_by?(user) + Authority.configuration.default_strategy.call(:#{adjective}, self, user) end RUBY end - ADJECTIVES.each do |adjective| + Authority.adjectives.each do |adjective| class_eval <<-RUBY, __FILE__, __LINE__ + 1 - def #{adjective}_by?(actor) - false + def #{adjective}_by?(user) + self.class.#{adjective}_by?(user) end RUBY end end