Ruby on rails - Ruby Basics

551 views

Published on

Code of the world we emplemented while the speak
https://gist.github.com/blazeeboy/5301160

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
551
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ruby on rails - Ruby Basics

  1. 1. Ruby Basics
  2. 2.  Ruby syntax Practice Solve last assignment New assignment Questions
  3. 3.  Irb Ruby SublimeText2 http://www.ruby-doc.org
  4. 4.  Printhello world Create world variables Write them in files
  5. 5. def name(param1,param2,param3) …code here…end Create a function that print world data
  6. 6.  Name : string Version : numeric Time : time Continents : array Creatures : hash Try double quoted strings, it is fun Try using symbols Use methods to capitalize keys
  7. 7.  Check classes for existing variables Add methods to objects Add methods to existing classes Create classes(world, human, animal, insect) Initialize attr_accessor class Name …code goes here… end
  8. 8.  If … end If … else If … elsif … else … end Check for day/night in world Unless Case … when … else … end Check for meal times in world While … end Until … end For x in arr … end Feed humans with animals
  9. 9.  Block_given? Yield Block Block with parameter Burry dead humans
  10. 10.  Dir • File  Pwd • Open  Glob • Close  Mkdir • Delete  Exists? • Readlines  Open • Rewind  Close • write  Enteries  each
  11. 11.  New libraries, modules …etc Rails is a gem Rails plugins are gems Gem install rails Gem update --system Gem update Gem install rails http://rubygems.org/
  12. 12.  Solve  http://projecteuler.net/problem=3 Read  http://guides.rubyonrails.org/getting_started.ht ml Practice (Plus)  http://railsforzombies.org/
  13. 13.  The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ?

×