class ActiveModel::AttributeMethods::ClassMethods::AttributeMethodPattern
:nodoc:
def initialize(prefix: "", suffix: "", parameters: nil)
def initialize(prefix: "", suffix: "", parameters: nil) @prefix = prefix @suffix = suffix @parameters = parameters.nil? ? "..." : parameters @regex = /\A(?:#{Regexp.escape(@prefix)})(.*)(?:#{Regexp.escape(@suffix)})\z/ @proxy_target = "#{@prefix}attribute#{@suffix}" @method_name = "#{prefix}%s#{suffix}" end
def match(method_name)
def match(method_name) if @regex =~ method_name AttributeMethod.new(proxy_target, $1) end end
def method_name(attr_name)
def method_name(attr_name) @method_name % attr_name end