    # File lib/rubygems/specification.rb, line 825
        def to_ruby
          mark_version
          result = []
          result << "Gem::Specification.new do |s|"

          result << "  s.name = #{ruby_code name}"
          result << "  s.version = #{ruby_code version}"
          unless platform.nil? or platform == Gem::Platform::RUBY then
            result << "  s.platform = #{ruby_code original_platform}"
          end
          result << ""
          result << "  s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version="

          handled = [
            :dependencies,
            :name,
            :platform,
            :required_rubygems_version,
            :specification_version,
            :version,
          ]

          attributes = @@attributes.sort_by { |attr_name,| attr_name.to_s }

          attributes.each do |attr_name, default|
            next if handled.include? attr_name
            current_value = self.send(attr_name)
            if current_value != default or
               self.class.required_attribute? attr_name then
              result << "  s.#{attr_name} = #{ruby_code current_value}"
            end
          end

          result << nil
          result << "  if s.respond_to? :specification_version then"
          result << "    current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION"
          result << "    s.specification_version = #{specification_version}"
          result << nil

          result << "    if current_version >= 3 then"

          unless dependencies.empty? then
            dependencies.each do |dep|
              version_reqs_param = dep.requirements_list.inspect
              dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
              result << "      s.add_#{dep.type}_dependency(%q<#{dep.name}>, #{version_reqs_param})"
            end
          end

          result << "    else"

          unless dependencies.empty? then
            dependencies.each do |dep|
              version_reqs_param = dep.requirements_list.inspect
              result << "      s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
            end
          end

          result << '    end'

          result << "  else"
            dependencies.each do |dep|
              version_reqs_param = dep.requirements_list.inspect
              result << "    s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
            end
          result << "  end"

          result << "end"
          result << nil

          result.join "\n"
        end