class ActiveModel::AttributeMethods::ClassMethods::AttributeMethodMatcher
:nodoc:
def initialize(options = {})
def initialize(options = {}) @prefix, @suffix = options.fetch(:prefix, ""), options.fetch(:suffix, "") @regex = /^(?:#{Regexp.escape(@prefix)})(.*)(?:#{Regexp.escape(@suffix)})$/ @method_missing_target = "#{@prefix}attribute#{@suffix}" @method_name = "#{prefix}%s#{suffix}" end
def match(method_name)
def match(method_name) if @regex =~ method_name AttributeMethodMatch.new(method_missing_target, $1, method_name) end end
def method_name(attr_name)
def method_name(attr_name) @method_name % attr_name end
def plain?
def plain? prefix.empty? && suffix.empty? end