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 for Newbies Vendors who are part of the IAB TCF914Reject allAccept all Purposes (Consent):Store and/or access information on a deviceCreate profiles for personalised advertisingUse profiles to select personalised advertisingPurposes (Legitimate Interest):Use limited data to select advertisingMeasure advertising performanceUnderstand audiences through statistics or combinations of data from different sourcesDevelop and improve servicesSpecial Purposes:Ensure security, prevent and detect fraud, and fix errorsDeliver and present advertising and contentSave and communicate privacy choicesCategories of data:IP addressesDevice characteristicsDevice identifiersProbabilistic identifiersBrowsing and interaction dataUser-provided dataNon-precise location dataUsers’ profilesPrivacy choicesData Retention Period:31 daysYour Consent:Consent expiry: 5 years 1 dayCookie expiry may be refreshed during the lifetime.Tracking method: Cookies onlyShow details

Ruby Quiz Ruby on Rails Tutorial: Learn Rails by Example book and screencasts by Michael Hartl Michael Hartl Contents Foreword My former company (CD Baby) was one of the first to loudly switch to Ruby on Rails, and then even more loudly switch back to PHP (Google me to read about the drama). This book by Michael Hartl came so highly recommended that I had to try it, and the Ruby on Rails Tutorial is what I used to switch back to Rails again. Though I’ve worked my way through many Rails books, this is the one that finally made me “get” it. The linear narrative is such a great format. Enjoy! Derek Sivers (sivers.org) Founder, CD Baby Acknowledgments The Ruby on Rails Tutorial owes a lot to my previous Rails book, RailsSpace, and hence to my coauthor Aurelius Prochazka. I’d like to acknowledge a long list of Rubyists who have taught and inspired me over the years: David Heinemeier Hansson, Yehuda Katz, Carl Lerche, Jeremy Kemper, Xavier Noria, Ryan Bates, Geoffrey Grosenbach, Peter Cooper, Matt Aimonetti, Gregg Pollack, Wayne E. About the author Copyright and license 1.1 Introduction

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

Why's (Poignant) Guide to Ruby Learn Ruby with the Neo Ruby Koans jQuery: The Write Less, Do More, JavaScript Library 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?

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:

Related: