Module: Allowable
- Included in:
- Hash
- Defined in:
- lib/allowable/allowable.rb,
lib/allowable/allow.rb,
lib/allowable/forbid.rb,
lib/allowable/railtie.rb,
lib/allowable/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 # => {}
Defined Under Namespace
Modules: Allow, Forbid Classes: Railtie
Constant Summary collapse
- VERSION =
'1.0.2'