Class: Evil::Client::Options
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Evil::Client::Options
- Defined in:
- lib/evil/client/options.rb
Overview
Wraps hash of options with railsy methods [#slice] and [#except]
Both methods works on the root level only. Nevertheless, this is sufficient to select/reject a part of the whole options collected from the very root of the client.
Instance Method Summary collapse
-
#except(*keys) ⇒ Hash
Returns a new hash where some keys are excluded from.
-
#slice(*keys) ⇒ Hash
Returns a new hash which include only selected keys.
Instance Method Details
#except(*keys) ⇒ Hash
Returns a new hash where some keys are excluded from
23 24 25 |
# File 'lib/evil/client/options.rb', line 23 def except(*keys) reject { |key| keys.flatten.include? key } end |
#slice(*keys) ⇒ Hash
Returns a new hash which include only selected keys
14 15 16 |
# File 'lib/evil/client/options.rb', line 14 def slice(*keys) select { |key| keys.flatten.include? key } end |