lib/authoraise.rb in authoraise-0.1.1 vs lib/authoraise.rb in authoraise-0.1.2

- old
+ new

@@ -4,14 +4,12 @@ module Authoraise Error = Class.new(RuntimeError) class << self; attr_accessor :strict_mode end - def authorize(options = {}) - policy = Policy.new - yield(policy) - policy.authorize(options) + def authorize(options = {}, &block) + Policy.new(&block).authorize(options) end class Check attr_reader :required_keys @@ -36,10 +34,10 @@ end class Policy def initialize @checks = [] - @mode = :any + yield(self) if block_given? end def allow(&procedure) @checks << Check.new(procedure.parameters.map(&:last), procedure)