Class: Aws::Templates::Utils::Contextualized::Filter::Identity

Inherits:
Aws::Templates::Utils::Contextualized::Filter show all
Defined in:
lib/aws/templates/utils/contextualized/filter/identity.rb

Overview

No-op filter

No-op filter or identity filter doesn’t perform any operations on passed options. The role of this filter is to play the role of identity function in par with lambda calculus.

Examples

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

  contextualize filter(:identity)
end

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

Class Method Summary collapse

Instance Method Summary collapse

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

#to_filter, #to_proc

Class Method Details

.newObject



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

def self.new
  @singleton ||= super()
end

Instance Method Details

#&(other) ⇒ Object



37
38
39
# File 'lib/aws/templates/utils/contextualized/filter/identity.rb', line 37

def &(other)
  other.to_filter
end

#filter(_, memo, _) ⇒ Object



33
34
35
# File 'lib/aws/templates/utils/contextualized/filter/identity.rb', line 33

def filter(_, memo, _)
  memo
end