# File lib/active_model/attribute_methods.rb, line 100
      def define_attr_method(name, value=nil, &block)
        sing = singleton_class
        sing.class_eval "if method_defined?('original_\#{name}')\nundef :'original_\#{name}'\nend\nalias_method :'original_\#{name}', :'\#{name}'\n", __FILE__, __LINE__ + 1
        if block_given?
          sing.send :define_method, name, &block
        else
          # If we can compile the method name, do it. Otherwise use define_method.
          # This is an important *optimization*, please don't change it. define_method
          # has slower dispatch and consumes more memory.
          if name =~ COMPILABLE_REGEXP
            sing.class_eval "def \#{name}; \#{value.nil? ? 'nil' : value.to_s.inspect}; end\n", __FILE__, __LINE__ + 1
          else
            value = value.to_s if value
            sing.send(:define_method, name) { value }
          end
        end
      end