Module: Allowable::Allow

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

Overview

Adds the #allow and #allow! methods

Instance Method Summary collapse

Instance Method Details

#allow(filters = {}) ⇒ Object



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

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

#allow!(filters = {}) ⇒ Object



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

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