Class: ParamsReady::Restriction::Denylist

Inherits:
ParamsReady::Restriction show all
Defined in:
lib/params_ready/restriction.rb

Instance Attribute Summary

Attributes inherited from ParamsReady::Restriction

#restriction

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ParamsReady::Restriction

blanket_permission, #delegate, #everything?, #for_children, from_array, #hash, #initialize, instance, #name_listed?, permit, permit_all, #permit_all, #permitted?, prohibit, #restriction_list_for, #to_restriction

Constructor Details

This class inherits a constructor from ParamsReady::Restriction

Class Method Details

.defaultObject



221
222
223
# File 'lib/params_ready/restriction.rb', line 221

def self.default
  Nothing
end

Instance Method Details

#name_permitted?(name) ⇒ Boolean

Returns:

  • (Boolean)


225
226
227
228
229
230
231
232
233
# File 'lib/params_ready/restriction.rb', line 225

def name_permitted?(name)
  return true unless name_listed?(name)
  return false unless @restriction.is_a?(Hash)
  return true if @restriction[name].is_a?(Array)
  return true if @restriction[name].is_a?(Symbol)
  return true if @restriction[name] == self.class.default

  false
end

#prohibit(*args) ⇒ Object



235
236
237
# File 'lib/params_ready/restriction.rb', line 235

def prohibit(*args)
  self.class.prohibit(*args)
end