Module: Allowable::Forbid

Included in:
Allowable
Defined in:
lib/allowable/forbid.rb

Overview

Adds the #forbid and #forbid! methods

Instance Method Summary collapse

Instance Method Details

#forbid(filters = {}) ⇒ Object



6
7
8
# File 'lib/allowable/forbid.rb', line 6

def forbid(filters = {})
  dup.forbid!(filters)
end

#forbid!(filters = {}) ⇒ Object



10
11
12
13
14
15
# File 'lib/allowable/forbid.rb', line 10

def forbid!(filters = {})
  filters.each do |key, val|
    delete(key) if Array(val).include?(self[key]) || val == self[key]
  end
  self
end