Module: Forbidium

Includes:
Allowable
Defined in:
lib/forbidium.rb,
lib/forbidium/version.rb

Overview

Filter hashes by setting allowed or forbidden values for specific keys.

hash = { one: 'one', two: 'two' }

hash.forbid(one: 'one') # => { two: 'two' }

hash.allow(one: 'two') # => { two: 'two' }

hash.allow(one: ['one', 'two']) # => { one: 'one', two: 'two' }

hash.forbid(one: ['one', 'two']) # => { two: 'two' }

hash.allow!(one: 'two') # => { two: 'two' }

hash.forbid!(two: 'two') # => {}

hash # => {}

Constant Summary collapse

VERSION =
'2.0.0'