Class: ConvenientService::Utils::Hash::Except Private

Inherits:
Support::Command show all
Defined in:
lib/convenient_service/utils/hash/except.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Examples:

Common usage.

ConvenientService::Utils::Hash::Except.call({foo: :bar, baz: :qux}, [:foo])
# => {baz: :qux}

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(hash, keys) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Since:

  • 1.0.0



34
35
36
37
# File 'lib/convenient_service/utils/hash/except.rb', line 34

def initialize(hash, keys)
  @hash = hash
  @keys = keys
end

Instance Attribute Details

#hashObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0



21
22
23
# File 'lib/convenient_service/utils/hash/except.rb', line 21

def hash
  @hash
end

#keysObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0



27
28
29
# File 'lib/convenient_service/utils/hash/except.rb', line 27

def keys
  @keys
end

Instance Method Details

#callHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

Since:

  • 1.0.0



46
47
48
# File 'lib/convenient_service/utils/hash/except.rb', line 46

def call
  hash.slice(*hash.keys - keys)
end