Class: Aws::Templates::Utils::Contextualized::Filter::Remove

Inherits:
RecursiveSchemaFilter show all
Defined in:
lib/aws/templates/utils/contextualized/filter/remove.rb

Overview

Remove specified keys from hash

The filter performs removal of values from options hash according to specified schema represented by combination of nested hashes and arrays. User can specify removal of values at arbitrary depth in options hash hierarchy with arbitrary granularity.

Example

class Piece
  include Aws::Templates::Utils::Contextualized

  contextualize filter(:copy) & filter(:remove, :a, :b, c: [:d])
end

i = Piece.new()
opts = Options.new(a: { q: 1 }, b: 2, c: { d: { r: 5 }, e: 1 })
opts.filter(i.filter) # => { c: { e: 1 } }

Instance Attribute Summary

Attributes inherited from RecursiveSchemaFilter

#scheme

Instance Method Summary collapse

Methods inherited from RecursiveSchemaFilter

#initialize

Methods inherited from Aws::Templates::Utils::Contextualized::Filter

#&, #to_filter, #to_proc

Constructor Details

This class inherits a constructor from Aws::Templates::Utils::Contextualized::Filter::RecursiveSchemaFilter

Instance Method Details

#filter(_, memo, _) ⇒ Object



31
32
33
34
# File 'lib/aws/templates/utils/contextualized/filter/remove.rb', line 31

def filter(_, memo, _)
  _recurse_remove(memo, scheme)
  memo
end