ruby-win32/lib/ruby/site_ruby/1.8/rubygems/specification.rb
# Returns a Ruby code representation of this specification, such that it
# can be eval'ed and reconstruct the same specification later.  Attributes
# that still have their default values are omitted.
Returns a Ruby code representation of this specification, such that it
can be eval'ed and reconstruct the same specification later.  Attributes
that still have their default values are omitted.
Returns a Ruby code representation of this specification such that it can be eval ' ed and reconstruct the same specification later . Attributes that still have their default values are omitted .
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.specification_version = #{specification_version} if s.respond_to? :specification_version="
      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 << "" unless dependencies.empty?
      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 << ""
      result.join "\n"
    end
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.specification_version = #{specification_version} if s.respond_to? :specification_version=" 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 << "" unless dependencies . empty? 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 << "" result . join "\n" end
Returns a Ruby code representation of this specification, such that it
can be eval'ed and reconstruct the same specification later.
Returns a Ruby code representation of this specification such that it can be eval ' ed and reconstruct the same specification later .