Skip to content

Commit

Permalink
Reduce memory usage due to Array allocations.
Browse files Browse the repository at this point in the history
  • Loading branch information
awmichel committed Jul 7, 2015
1 parent c3b5e2c commit 0291cfd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/cancan/rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def initialize(base_behavior, action, subject, conditions, block)
raise Error, "You are not able to supply a block with a hash of conditions in #{action} #{subject} ability. Use either one." if conditions.kind_of?(Hash) && !block.nil?
@match_all = action.nil? && subject.nil?
@base_behavior = base_behavior
@actions = [action].flatten
@subjects = [subject].flatten
@conditions = conditions || {}
@actions = Array(action)
@subjects = Array(subject)
@conditions = conditions
@block = block
end

Expand Down

0 comments on commit 0291cfd

Please sign in to comment.