Amazing Ruby Library

Source: Internet
Author: User
Ruby tips Thor

Http://asciicasts.com/episodes/242-thor

Sinatra

Sinatra is a set of micro-web small frameworks that combine small Web apps or for Web Services. It is neither MVC nor built-in Orm. The most important thing is that it provides a set of routing systems.

Jekyll

Jekyll is a very simple website production tool that allows you to share layout, use textile, or markdown formats. It is also very helpful to build a blog.

This copyright was produced using Jekyll.

Handling case

File-type internal scripting http://ruby-doc.org/core/classes/File.html built in ruby

Handling HTTP

Please refer to the HTTP client article.

Yaml

Rails data depends on your database. yml is written in a format called: yaml ain't markup language. When the case is opened, it looks like a general plain setting scheme, which is very easy to modify.

The primary goal of yaml design is to make it easy for users to understand and can work well with Script statement. The functions include data serialization, configuration setting, log files, internet messaging, and filtering. Supported script scripts are known on the website, including python, Ruby, Java, PHP, Perl, and JavaScript.

require ‘yaml’ps2 = YAML.load_file(‘example.yaml’)ps2.each do |it|  puts it.inspectend
JSON

Activesupport JSON is available in rails. Its usage is as follows:

ActiveSupport::JSON.encode( [ {:a => 1 , :b => 2 } , "c", "d" ] )=> "[{\"a\":1,\"b\":2},\"c\",\"d\"]" ActiveSupport::JSON.decode( "[{\"a\":1,\"b\":2},\"c\",\"d\"]" )=> [{"a"=>1, "b"=>2}, "c", "d"] 

Yajl-Ruby is a set of JSON parser with C, which is faster than parse.

If you want to create a JSON handler for rails, add the following at the bottom of config/application. RB:

ActiveSupport::JSON.backend = 'Yajl'
XML

The XML function builder of Ruby is used in rails.

Nokogiri is a set of function libraries based on libxml2, with excellent performance. You can refer to the Getting Started with nokogiri document to explain the usage.

If you want to create an XML function for rails, add it at the bottom of config/application. RB:

ActiveSupport::XmlMini.backend = 'Nokogiri'
PDF

Prawn can generate PDF files and support Unicode.

Development Kit is another interesting production method, which passes through HTML/CSS development PDF.

CSV

Fastercsv is a set of CSV functions of pure Ruby, which is also built in Ruby 1.9.

Excelsior is a set of bottom-layer functions that are used in C.

Yaml, JSON, XML, CSV, and so on all have a base scheme to use the C function, which is equivalent to the formal environment. The missing point is the need to compile the code, in some special regions, it may not work. For example, the latest nokogiri version does not support windows. The actual version of Ruby does not have this problem.

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.