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
# 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