class method self.new

Ruby on Rails 3.2.22.5

Since v3.0.20 Last seen in v3.2.22.5

Available in: v3.0.20 v3.1.12 v3.2.22.5

Signature

self.new(options = {})

No documentation comment.

Parameters

options opt = {}
Source
# File activemodel/lib/active_model/attribute_methods.rb, line 355
          def initialize(options = {})
            options.symbolize_keys!

            if options[:prefix] == '' || options[:suffix] == ''
              ActiveSupport::Deprecation.warn(
                "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."
              )
            end

            @prefix, @suffix = options[:prefix] || '', options[:suffix] || ''
            @regex = /\A(#{Regexp.escape(@prefix)})(.+?)(#{Regexp.escape(@suffix)})\z/
            @method_missing_target = "#{@prefix}attribute#{@suffix}"
            @method_name = "#{prefix}%s#{suffix}"
          end

Defined in activemodel/lib/active_model/attribute_methods.rb line 355 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveModel::AttributeMethods::ClassMethods::AttributeMethodMatcher

Type at least 2 characters to search.

↑↓ navigate · open · esc close