What is Ruby?
Ruby is an interpreted object-oriented programming language often used for web development. It also offers many scripting features to process plain text and serialized files, or manage system tasks. It is simple, straightforward, and extensible.
Features of Ruby
- Simple Syntax
- Normal Object-oriented Features (e.g. class, method calls)
- Advanced Object-oriented Features (e.g. mix-in, singleton-method)
- Operator Overloading
- Exception Handling
- Iterators and Closures
- Garbage Collection
- Dynamic Loading of Object Files (on some architectures)
- Highly Portable (works on many Unix-like/POSIX compatible platforms as well as Windows, macOS, etc.) cf. //github.com/ruby/ruby/blob/master/doc/maintainers.rdoc#label-Platform+Maintainers
How to get Ruby with Git
For a complete list of ways to install Ruby, including using third-party tools like rvm, see:
//www.ruby-lang.org/en/downloads/
The mirror of the Ruby source tree can be checked out with the following command:
$ git clone //github.com/ruby/ruby.git
There are some other branches under development. Try the following command to see the list of branches:
$ git ls-remote //github.com/ruby/ruby.git
You may also want to use //git.ruby-lang.org/ruby.git (actual master of Ruby source) if you are a committer.
How to build
see Building Ruby
Ruby home page
//www.ruby-lang.org/
Documentation
- English
- Japanese
Mailing list
There is a mailing list to discuss Ruby. To subscribe to this list, please send the following phrase:
in the mail body (not subject) to the address .
Copying
See the file COPYING.
Feedback
Questions about the Ruby language can be asked on the Ruby-Talk mailing list or on websites like //stackoverflow.com.
Bugs should be reported at //bugs.ruby-lang.org. Read "Reporting Issues" for more information.
Contributing
See "Contributing to Ruby", which includes setup and build instructions.
The Author
Ruby was originally designed and developed by Yukihiro Matsumoto (Matz) in 1995.
Is RubyInstaller for you?
RubyInstaller is the easiest and most widely-used Ruby environment on Windows. And Ruby is a great language for beginners as well as professionals. It’s suitable for small scripts as well as large applications. RubyInstaller combines the possibilities of native Windows programs with the rich UNIX toolset of MSYS2 and the large repository of MINGW libraries. RubyInstaller is a great foundation for using Ruby for development and production … Read more
Learn Ruby
Online Ruby Programming Course
If you’re new to Ruby, check out this online course from The Pragmatic Studio to learn all the fundamentals of object-oriented programming with Ruby.
Online Rails Programming Course
If you’re looking to create Ruby on Rails web apps, you’ll learn how to build a complete Rails 4 app step-by-step in this online course also from The Pragmatic Studio.
Compress the complexity of modern web apps.
Learn just what you need to get started, then keep leveling up as you go. Ruby on Rails scales from HELLO WORLD to IPO.
You’re in good company.
Over the past two decades, Rails has taken countless companies to millions of users and billions in market valuations.
These are just a few of the big names. There have been many hundreds of thousands of apps created with Rails since its inception.
Building it together.
Over six thousand people have contributed code to Rails, and many more have served the community through evangelism, documentation, and bug reports. Join us!
Everything you need.
Rails is a full-stack framework. It ships with all the tools needed to build amazing web apps on both the front and back end.
Rendering HTML templates, updating databases, sending and receiving emails, maintaining live pages via WebSockets, enqueuing jobs for asynchronous work, storing uploads in the cloud, providing solid security protections for common attacks. Rails does it all and so much more.
app/models/article.rbclass Article < ApplicationRecord belongs_to :author, default: -> { Current.user } has_many :comments has_one_attached :cover_image has_rich_text :content, encrypted: true enum status: %i[ drafted published ] scope :recent, -> { order(created_at: :desc).limit(25) } after_save_commit :deliver_later, if: :published? def byline "Written by #{author.name} on #{created_at.to_s(:short)}" end def deliver_later Article::DeliveryJob.perform_later(self) end end
Active Records make modeling easy.
Databases come to life with business logic encapsulated in rich objects. Modeling associations between tables, providing callbacks when saved, encrypting sensitive data seamlessly, and expressing SQL queries beautifully.
app/controllers/articles_controller.rbclass ArticlesController < ApplicationController def index @articles = Article.recent end def show @article = Article.find(params[:id]) fresh_when etag: @article end def create article = Article.create!(article_params) redirect_to article end private def article_params params.require(:article).permit(:title, :content) end end
Action Controllers handle all requests.
Controllers expose the domain model to the web, process incoming parameters, set caching headers, and render templates, responding with either HTML or JSON.
app/views/articles/show.html.erb<h2><%= @article.title %></h2> <%= image_tag @article.cover_image.url %> <p><%= @article.content %></p> <%= link_to "Edit", edit_article_path(@article) if Current.user.admin? %>
Action Views mix Ruby and HTML.
Templates can use the full versatility of Ruby, excessive code is extracted into helpers, and the domain model is used directly and interwoven with the HTML.
config/routes.rbRails.application.routes.draw do resources :articles do # /articles, /articles/1 resources :comments # /articles/1/comments, /comments/1 end root to: "articles#index" # / end
Action Dispatch route URLs.
Configure how URLs connect to the controllers using the routing domain language. Routes expose the bundle of actions that go together as a resource: index, show, new, create, edit, update, destroy.
Optimized for happiness.
Rails has united and cultivated a strong tribe around a wide set of heretical thoughts about the nature of programming and programmers. Understanding these thoughts will help you understand the design of the framework.