Class: Aws::Templates::Utils::Contextualized::Filter::Scoped

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

Overview

Statically scoped filter

Scoped filter wraps whatever Proc obejct passed to it into specified scope for execution. So whatever the scope the filter is called in, it will always be evaluated in the same scope specified at creation.

The filter is used by the internal mechanics of the framework.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#&, #to_filter, #to_proc

Constructor Details

#initialize(fltr, scp) ⇒ Scoped

Returns a new instance of Scoped.



22
23
24
25
# File 'lib/aws/templates/utils/contextualized/filter/scoped.rb', line 22

def initialize(fltr, scp)
  @scoped_filter = _check_filter(fltr)
  @scope = scp
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



20
21
22
# File 'lib/aws/templates/utils/contextualized/filter/scoped.rb', line 20

def scope
  @scope
end

#scoped_filterObject (readonly)

Returns the value of attribute scoped_filter.



19
20
21
# File 'lib/aws/templates/utils/contextualized/filter/scoped.rb', line 19

def scoped_filter
  @scoped_filter
end

Instance Method Details

#filter(options, memo, _) ⇒ Object



27
28
29
# File 'lib/aws/templates/utils/contextualized/filter/scoped.rb', line 27

def filter(options, memo, _)
  scope.instance_exec(options, memo, &scoped_filter)
end