Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 9f76659bb8
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (30 sloc) 0.666 kB
require 'set'
module ActiveModel
module MassAssignmentSecurity
class PermissionSet < Set
def +(values)
super(values.map(&:to_s))
end
def include?(key)
super(remove_multiparameter_id(key))
end
def deny?(key)
raise NotImplementedError, "#deny?(key) supposed to be overwritten"
end
protected
def remove_multiparameter_id(key)
key.to_s.gsub(/\(.+/, '')
end
end
class WhiteList < PermissionSet
def deny?(key)
!include?(key)
end
end
class BlackList < PermissionSet
def deny?(key)
include?(key)
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.