Skip to content

Commit

Permalink
Merge pull request #204 from timraymond/array-over-flatten
Browse files Browse the repository at this point in the history
Reduce unnecessary allocations in Rule creation
  • Loading branch information
coorasse committed Apr 6, 2017
2 parents 45d752a + c81cf44 commit 6fc1215
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cancan/rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def initialize(base_behavior, action, subject, conditions, block)
raise Error, both_block_and_hash_error if conditions.is_a?(Hash) && block
@match_all = action.nil? && subject.nil?
@base_behavior = base_behavior
@actions = [action].flatten
@subjects = [subject].flatten
@actions = Array(action)
@subjects = Array(subject)
@conditions = conditions || {}
@block = block
end
Expand Down

0 comments on commit 6fc1215

Please sign in to comment.