Module: ActiveModel::AttributeFilters::FilteringRegistration

Included in:
ClassMethods
Defined in:
lib/attribute-filters/common_filters.rb

Overview

This module holds method for marking methods as filters.

Instance Method Summary collapse

Instance Method Details

#filtering_method(method_name, set_name) Also known as: has_filtering_method

This method returns an undefined value.

This method marks a method as filtering method and associates it with the given name of an attribute set it uses.

Parameters:

  • method_name (Symbol)

    name of a method

  • set_name (Symbol)

    name of an attribute set



22
23
24
25
26
27
28
# File 'lib/attribute-filters/common_filters.rb', line 22

def filtering_method(method_name, set_name)
  set_name = set_name.to_sym
  return unless method_defined?(method_name)
  f = (@attribute_filters ||= MetaSet.new)
  f[set_name] = method_name unless f.key?(set_name)
  nil
end