background preloader

Ruby Tutorial

Ruby Tutorial
RubyLearning.com Helping Ruby Programmers become Awesome! Ruby Study Notes: TOC Core Ruby Programming Introduction InstallationWhat is Ruby? Note: The Ruby Logo is Copyright (c) 2006, Yukihiro Matsumoto. © 2006-2017 RubyLearning.com - A Ruby Tutorial Page Updated: 1st Jan. 2016 | Design: Erwin Aligam | Valid: XHTML | CSS Home | Privacy | Sitemap

Ruby Programming Ruby is an interpreted, object-oriented programming language. Its creator, Yukihiro Matsumoto, a.k.a “Matz,” released it to the public in 1995. Its history is covered here. Its many features are listed here. The book is currently broken down into several sections and is intended to be read sequentially. Getting started will show how to install and get started with Ruby in your environment. Table of Contents[edit] Getting started[edit] Overview Installing Ruby Ruby editors Notation conventions Interactive Ruby Mailing List FAQ Basic Ruby[edit] Hello world Strings Alternate quotes Here documents Encoding Introduction to objects Ruby basics Data types — numbers, strings, hashes and arrays Writing methods Classes and objects Exceptions Ruby Semantic reference[edit] See also some rdoc documentation on the various keywords. Built in Classes[edit] This is a list of classes that are available to you by default in Ruby. Available Standard Library Modules[edit] Other Libraries[edit] Database Interface Modules Unit testing

Ruby Quiz jQuery: The Write Less, Do More, JavaScript Library Why's (Poignant) Guide to Ruby Factory Girl Hits 3.0! Factory Girl is now 3.0! It's been a wonderful eight months and I'm really excited about what we've added in 2.x. We've adopted semantic versioning and it's been a good way to ensure that we're providing software that's reliable and stable. The Big Changes No more Ruby 1.8 support You heard correctly; FactoryGirl requires Ruby 1.9+. If you can't upgrade to Ruby 1.9 and Rails 3, you can continue to use factory_girl_rails version 1.x and FactoryGirl 2.x; those will continue to support Ruby 1.8.7+ and Rails 2.3.9+. No more Rails 2 support FactoryGirl 3.0 now only supports Rails 3.x. Vintage syntax deprecated The vintage syntax has been deprecated and will be removed in the next major release. Factory(:comment) Factory.next(:email) Factory.stub(:article) Factory.define(:admin_user, :parent => :user) do |admin| admin.admin trueend The alternates for each of these would be (after configuring FactoryGirl to play nicely with RSpec, Test::Unit, or Cucumber): Upgrading If you're not running Rails:

Ruby in Twenty Minutes Introduction This is a small Ruby tutorial that should take no more than 20 minutes to complete. It makes the assumption that you already have Ruby installed. (If you do not have Ruby on your computer install it before you get started.) Interactive Ruby Ruby comes with a program that will show the results of any Ruby statements you feed it. Open up IRB (which stands for Interactive Ruby). If you’re using macOS open up Terminal and type irb, then hit enter. irb(main):001:0> Ok, so it’s open. Type this: "Hello World" irb(main):001:0> "Hello World" => "Hello World" Ruby Obeyed You! What just happened? irb(main):002:0> puts "Hello World" Hello World => nil puts is the basic command to print something out in Ruby. Your Free Calculator is Here Already, we have enough to use IRB as a basic calculator: irb(main):003:0> 3+2 => 5 Three plus two. irb(main):004:0> 3*2 => 6 Next, let’s try three squared: irb(main):005:0> 3**2 => 9 In Ruby ** is the way you say “to the power of”. Ok, wait, what was that last one?

The Best Way to Learn Rails I come from a PHP background, but these days, I'm a full-time Rails developer. The difficulty for most people who make the switch lies in the learning curve that’s involved. Once you've become proficient in a language or framework, switching to a new one feels like an unnecessary (and time-consuming) challenge. However, learning Ruby and Rails is actually pretty easy! It's an incredibly powerful framework, and has a huge community pushing it along. So that begs the question: what's the best way to learn Rails? This article details a full lesson plan that will get you up and running in no time! You might think learning Ruby is the most important step, and this is probably the part where everyone stops learning and just sticks with their current framework. Work through the Try Ruby exercises. The most recommended tool for dipping into Ruby's syntax is the Try Ruby website. Once you’ve worked through these exercises a couple of times, you'll have a solid base. Great! Railscasts: A must!

Related: