Sha256: 3a8eed0ff3414cfad546bbcdb81ab9062cc755de4dd9ca91cb24f484bb6341dc

Contents?: true

Size: 527 Bytes

Versions: 9

Compression:

Stored size: 527 Bytes

Contents

module RoleAuthorization
  module Rules
    class Rule
      attr_accessor :role, :options
      attr_accessor :returning

      # for calls to authorized?
      attr_accessor :controller_instance, :controller, :action, :id

      def initialize(role, options, &block)
        @returning = block
        @role = role
        @options = options

        self
      end

      def authorized?(*args)
        @controller_instance, @controller, @action, @id = args

        instance_eval(&returning)
      end
    end
  end
end



Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
role_authorization-0.5.9 lib/role_authorization/rules/rule.rb
role_authorization-0.5.8 lib/role_authorization/rules/rule.rb
role_authorization-0.5.7 lib/role_authorization/rules/rule.rb
role_authorization-0.5.6 lib/role_authorization/rules/rule.rb
role_authorization-0.5.5 lib/role_authorization/rules/rule.rb
role_authorization-0.5.4 lib/role_authorization/rules/rule.rb
role_authorization-0.5.3 lib/role_authorization/rules/rule.rb
role_authorization-0.5.2 lib/role_authorization/rules/rule.rb
role_authorization-0.5.1 lib/role_authorization/rules/rule.rb