Creating XML Applications with Ruby+builder

Source: Internet
Author: User
Tags command line documentation ruby on rails


First, Introduction



Since the advent of Ruby on Rails last year, interest in the Ruby programming language seems to have grown steadily. Rails has helped people see what Ruby is: A very decent, easy to learn and fun-filled language, even for the development of industrial-grade applications. Ruby is now almost the same age as Java, but until now it has attracted people's attention.



Ruby, of course, has caught my eye! Lately, I've found myself using Ruby more than Java, because it helps me encode faster-the same work, but less keystrokes. I simply doubted whether I had actually given up Java completely and turned to Ruby. When you've finished reading this, you'll understand why.



Builder is a lightweight XML builder that originally came from rails engineering. Now, it's a standalone Ruby library that you can download from RubyForge.



This article describes how to install builder and then use Builder in Ruby to create XML documents without the need for rails. Of course, I don't involve all the features of builder, but it's enough for the content in this article. Of course, you can refer to builder's online documentation for detailed analysis.



Second, install Ruby and builder



First, let's go to the Ruby download page. You can download the current stable release version at this address. If you are using a Windows platform, the easiest way to install Ruby is to use one-click Ruby Installer (version 1.8.2), and if you use a different platform, you can use the 1.8.3 version, which is a file that is compressed by tar and gzip. (By the way, version 1.8.2 is recommended for rails, while the 1.8.4 version is in the preview release phase). You can test your installation by typing "ruby-v" on the command line. If Ruby has a response, then you may be successful, and if there are some prompts from the operating system, it is likely that there is a problem with your installation.



To date, the easiest way to install Builder is to use RubyGems, an excellent package management program for Ruby. I'll just make a brief introduction here. First, download the RubyGems and run "Ruby setup.rb". After you install RubyGems, enter the following statement in a shell:



Gem Install Builder



If all goes well, you should see the following response:



Attempting local installation of 'builder'
Local gem file not found: builder*.gem
Attempting remote installation of 'builder'
Updating Gem source index for: http://gems.rubyforge.org
Successfully installed builder-1.2.4
Installing RDoc documentation for builder-1.2.4...



Once Ruby and builder are in place, you can start working.





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.