Methods
M
N
P
Constants
AttributeMethodMatch = Struct.new(:target, :attr_name, :method_name)
Attributes
[R] prefix
[R] suffix
[R] method_missing_target
Class Public methods
new(options = {})
     # File activemodel/lib/active_model/attribute_methods.rb, line 358
358:           def initialize(options = {})
359:             options.symbolize_keys!
360: 
361:             if options[:prefix] == '' || options[:suffix] == ''
362:               ActiveSupport::Deprecation.warn(
363:                 "Specifying an empty prefix/suffix for an attribute method is no longer " \
364:                 "necessary. If the un-prefixed/suffixed version of the method has not been " \
365:                 "defined when `define_attribute_methods` is called, it will be defined " \
366:                 "automatically."
367:               )
368:             end
369: 
370:             @prefix, @suffix = options[:prefix] || '', options[:suffix] || ''
371:             @regex = /^(#{Regexp.escape(@prefix)})(.+?)(#{Regexp.escape(@suffix)})$/
372:             @method_missing_target = "#{@prefix}attribute#{@suffix}"
373:             @method_name = "#{prefix}%s#{suffix}"
374:           end
Instance Public methods
match(method_name)
     # File activemodel/lib/active_model/attribute_methods.rb, line 376
376:           def match(method_name)
377:             if @regex =~ method_name
378:               AttributeMethodMatch.new(method_missing_target, $2, method_name)
379:             else
380:               nil
381:             end
382:           end
method_name(attr_name)
     # File activemodel/lib/active_model/attribute_methods.rb, line 384
384:           def method_name(attr_name)
385:             @method_name % attr_name
386:           end
plain?()
     # File activemodel/lib/active_model/attribute_methods.rb, line 388
388:           def plain?
389:             prefix.empty? && suffix.empty?
390:           end