class Aws::Templates::Utils::Contextualized::Filter::Scoped
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.
Attributes
scope[R]
scoped_filter[R]
Public Class Methods
new(fltr, scp)
click to toggle source
# File lib/aws/templates/utils/contextualized/filter/scoped.rb, line 22 def initialize(fltr, scp) @scoped_filter = _check_filter(fltr) @scope = scp end
Public Instance Methods
filter(options, memo, _)
click to toggle source
# File lib/aws/templates/utils/contextualized/filter/scoped.rb, line 27 def filter(options, memo, _) scope.instance_exec(options, memo, &scoped_filter) end
Private Instance Methods
_check_filter(fltr)
click to toggle source
# File lib/aws/templates/utils/contextualized/filter/scoped.rb, line 33 def _check_filter(fltr) raise "#{fltr} is not a filter" unless fltr.respond_to?(:to_proc) fltr end