Parent

Class Index [+]

Quicksearch

ActiveModel::AttributeMethods::ClassMethods::AttributeMethodMatcher

Constants

AttributeMethodMatch

Attributes

prefix[R]
suffix[R]
method_missing_target[R]

Public Class Methods

new(options = {}) click to toggle source
     # File lib/active_model/attribute_methods.rb, line 355
355:           def initialize(options = {})
356:             options.symbolize_keys!
357: 
358:             if options[:prefix] == '' || options[:suffix] == ''
359:               ActiveSupport::Deprecation.warn(
360:                 "Specifying an empty prefix/suffix for an attribute method is no longer "                  "necessary. If the un-prefixed/suffixed version of the method has not been "                  "defined when `define_attribute_methods` is called, it will be defined "                  "automatically."
361:               )
362:             end
363: 
364:             @prefix, @suffix = options[:prefix] || '', options[:suffix] || ''
365:             @regex = /\A(#{Regexp.escape(@prefix)})(.+?)(#{Regexp.escape(@suffix)})\z/
366:             @method_missing_target = "#{@prefix}attribute#{@suffix}"
367:             @method_name = "#{prefix}%s#{suffix}"
368:           end

Public Instance Methods

match(method_name) click to toggle source
     # File lib/active_model/attribute_methods.rb, line 373
373:           def match(method_name)
374:             if @regex =~ method_name
375:               AttributeMethodMatch.new(method_missing_target, $2, method_name)
376:             else
377:               nil
378:             end
379:           end
method_name(attr_name) click to toggle source
     # File lib/active_model/attribute_methods.rb, line 381
381:           def method_name(attr_name)
382:             @method_name % attr_name
383:           end
plain?() click to toggle source
     # File lib/active_model/attribute_methods.rb, line 385
385:           def plain?
386:             prefix.empty? && suffix.empty?
387:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.