class ActiveModel::AttributeMethods::ClassMethods::AttributeMethodMatcher
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/active_model/attribute_methods.rbs class ActiveModel::AttributeMethods::ClassMethods::AttributeMethodMatcher def match: (String method_name) -> untyped def method_name: (String attr_name) -> untyped end
:nodoc:
def initialize(prefix: "", suffix: "", parameters: nil)
def initialize(prefix: "", suffix: "", parameters: nil) @prefix = prefix @suffix = suffix @parameters = parameters.nil? ? FORWARD_PARAMETERS : parameters @regex = /^(?:#{Regexp.escape(@prefix)})(.*)(?:#{Regexp.escape(@suffix)})$/ @target = "#{@prefix}attribute#{@suffix}" @method_name = "#{prefix}%s#{suffix}" end
def match(method_name)
Experimental RBS support (using type sampling data from the type_fusion
project).
def match: (String method_name) -> untyped
This signature was generated using 2 samples from 1 application.
def match(method_name) if @regex =~ method_name AttributeMethodMatch.new(target, $1) end end
def method_name(attr_name)
Experimental RBS support (using type sampling data from the type_fusion
project).
def method_name: (String attr_name) -> untyped
This signature was generated using 15 samples from 1 application.
def method_name(attr_name) @method_name % attr_name end