Method: FilterTable::Factory#register_filter_method

Defined in:
lib/utils/filter.rb

#register_filter_method(method_name) ⇒ Object Also known as: add_accessor

TODO: This should almost certainly be privatized. Every FilterTable client should get :entries and :where; InSpec core resources do not define anything else, other than azure_generic_resource, which is likely a mis-use.



375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/utils/filter.rb', line 375

def register_filter_method(method_name)
  if method_name.nil?
    # TODO: @resource is never initialized
    throw RuntimeError, "Called filter.add_accessor for resource #{@resource} with method name nil!"
  end
  if @filter_methods.include? method_name.to_sym
    # TODO: issue deprecation warning?
  else
    @filter_methods.push(method_name.to_sym)
  end
  self
end