class Aws::Templates::Utils::Contextualized::Filter::RecursiveSchemaFilter

Base class for recursive operations

Internally used by Add and Remove filters.

Attributes

scheme[R]

Public Class Methods

new(*args) click to toggle source
# File lib/aws/templates/utils/contextualized/filter/recursive_schema_filter.rb, line 17
def initialize(*args)
  schm = if args.last.respond_to?(:to_hash)
    args.each_with_object(args.pop) do |field, hsh|
      hsh[field] = nil
      hsh
    end
  else
    args
  end

  @scheme = _check_scheme(schm)
end

Private Instance Methods

_check_scheme(schm) click to toggle source
# File lib/aws/templates/utils/contextualized/filter/recursive_schema_filter.rb, line 32
def _check_scheme(schm)
  if schm.respond_to?(:to_hash)
    schm.to_hash.each_pair { |_, sub| _check_scheme(sub) unless sub.nil? }
  elsif !schm.respond_to?(:to_a)
    raise "#{schm.inspect} is not appropriate branch in the scheme"
  end

  schm
end