Skip to content

Commit

Permalink
Support JRuby 9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Burgestrand committed Mar 7, 2024
1 parent 44443a5 commit eaf3765
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions lib/pundit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,24 @@ def authorize(user, record, query, policy_class: nil, cache: {})
end

# @see [Pundit::Context#policy_scope]
def policy_scope(user, ...) = Context.new(user: user).policy_scope(...)
def policy_scope(user, *args, **kwargs, &block)
Context.new(user: user).policy_scope(*args, **kwargs, &block)
end

# @see [Pundit::Context#policy_scope!]
def policy_scope!(user, ...) = Context.new(user: user).policy_scope!(...)
def policy_scope!(user, *args, **kwargs, &block)
Context.new(user: user).policy_scope!(*args, **kwargs, &block)
end

# @see [Pundit::Context#policy]
def policy(user, ...) = Context.new(user: user).policy(...)
def policy(user, *args, **kwargs, &block)
Context.new(user: user).policy(*args, **kwargs, &block)
end

# @see [Pundit::Context#policy!]
def policy!(user, ...) = Context.new(user: user).policy!(...)
def policy!(user, *args, **kwargs, &block)
Context.new(user: user).policy(*args, **kwargs, &block)
end
end

# @api private
Expand Down
4 changes: 2 additions & 2 deletions lib/pundit/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def policy!(record)

private

def policy_finder(...)
PolicyFinder.new(...)
def policy_finder(*args, **kwargs, &block)
PolicyFinder.new(*args, **kwargs, &block)
end

def pundit_model(record)
Expand Down

0 comments on commit eaf3765

Please sign in to comment.