module ActiveModel::AttributeMethods

def matched_attribute_method(method_name)

The struct's attributes are prefix, base and suffix.
Returns a struct representing the matching attribute method.
def matched_attribute_method(method_name)
  matches = self.class.send(:attribute_method_matchers_matching, method_name)
  matches.detect { |match| attribute_method?(match.attr_name) }
end