Class: Mutant::Transform::Hash::Slice Private

Inherits:
Mutant::Transform show all
Defined in:
lib/mutant/transform.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.

Transform reducing a hash to the keys it names

A document another tool writes carries keys mutant has no use for, and gains more between versions. Slicing ahead of a Hash transform lets that transform stay strict about the keys it does know.

Instance Method Summary collapse

Methods inherited from Mutant::Transform

#slug

Instance Method Details

#call(input) ⇒ Either<Error, Hash>

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.

Apply transformation to input

Parameters:

  • input (Object)

Returns:



311
312
313
314
315
316
# File 'lib/mutant/transform.rb', line 311

def call(input)
  PRIMITIVE
    .call(input)
    .lmap(&method(:lift_error))
    .fmap { |hash| hash.slice(*keys) }
end