Class: Aws::Templates::Utils::Contextualized::Filter::Add

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

Overview

Add specified keys into the hash

Selective version of Copy filter. It adds key-value pairs or whole subtrees from options into the memo hash. It does this according to specified schema represented by combination of nested hashes and arrays. User can specify addition of values at arbitrary depth in options hash hierarchy with arbitrar granularity.

Example

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

  contextualize filter(:add, :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) # => { a: { q: 1 }, b: 2, c: { d: { r: 5 } } }

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(options, memo, _) ⇒ Object



30
31
32
# File 'lib/aws/templates/utils/contextualized/filter/add.rb', line 30

def filter(options, memo, _)
  _recurse_add(options, memo, scheme)
end