Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Ruby 101Redu-dev team
Ruby 101• A dynamic, object oriented (really)  open source programming language  with a focus on simplicity and  productiv...
irb• Stands for interactive ruby• For pythonists it’s an common  concept• For Java programmers is like a bash  session wit...
Dynamically typed• Types are bound to values not to  variables  1 my_var = "string"  2 my_var = 12
Everything is an object• Really  1   20.to_s # "20"  2  3   100.times do  4     puts "100 is an object"  5   end  6   # "1...
Dynamic language• Some actions happens at runtime 9   class Person10     def say_hello      21   p = Person.new11       "h...
Methods 8 def my_method(arg, arg2="default") 9   "always returning the last line"10 end
Control structures30 if a > b                    40 result = if a > b31   "a is greater than b"     41   "a is greater tha...
Hashes• For pythonists: dictionaries• For Java programmers: associative  arrays46 concepts = { "ruby" => "programming", "l...
Symbols• A symbol is something that you use to  represent names. What this boils  down to is a way to efficiently have  desc...
49 concepts = { :ruby => "programming", :learning=> "education" }
Blocks/Procs• Way to pass around chunks of code 51   def new_method(arg="default", &block) 52     puts "the arg is: #{arg}...
Symbols• Usually used as hashes keys
Dojo• With TDD (Test driven development)• A non-sense problem to be solved  collaboratively• Tools • RSpec • Bundler • RVM
Upcoming SlideShare
Loading in …5
×
Upcoming SlideShare
Ruby 101 session 5
Next
Download to read offline and view in fullscreen.

0

Share

Download to read offline

Ruby 101 && Coding Dojo

Download to read offline

https://github.com/guiocavalcanti/ruby-101-dev-day

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

Ruby 101 && Coding Dojo

  1. 1. Ruby 101Redu-dev team
  2. 2. Ruby 101• A dynamic, object oriented (really) open source programming language with a focus on simplicity and productivity.
  3. 3. irb• Stands for interactive ruby• For pythonists it’s an common concept• For Java programmers is like a bash session within the interpreter
  4. 4. Dynamically typed• Types are bound to values not to variables 1 my_var = "string" 2 my_var = 12
  5. 5. Everything is an object• Really 1 20.to_s # "20" 2 3 100.times do 4 puts "100 is an object" 5 end 6 # "100 is an object", "100 is an object"
  6. 6. Dynamic language• Some actions happens at runtime 9 class Person10 def say_hello 21 p = Person.new11 "hello" 22 p.say_hello12 end 23 # hello13 end 24 p.say_goodye14 25 # goodbye15 class Person16 def say_goodye17 "goodbye"18 end19 end
  7. 7. Methods 8 def my_method(arg, arg2="default") 9 "always returning the last line"10 end
  8. 8. Control structures30 if a > b 40 result = if a > b31 "a is greater than b" 41 "a is greater than b"32 else 42 else33 "a isnt greater than b" 43 "a isnt greater than b"34 end 44 end
  9. 9. Hashes• For pythonists: dictionaries• For Java programmers: associative arrays46 concepts = { "ruby" => "programming", "learning" =>"education" }47 concepts["ruby"]
  10. 10. Symbols• A symbol is something that you use to represent names. What this boils down to is a way to efficiently have descriptive names while saving the space one would use to generate a string for each naming instance.
  11. 11. 49 concepts = { :ruby => "programming", :learning=> "education" }
  12. 12. Blocks/Procs• Way to pass around chunks of code 51 def new_method(arg="default", &block) 52 puts "the arg is: #{arg}" 53 block.call 54 end 55 56 new_method do 57 puts "Callback" 58 end 59 60 # the arg is: default 61 # Callback
  13. 13. Symbols• Usually used as hashes keys
  14. 14. Dojo• With TDD (Test driven development)• A non-sense problem to be solved collaboratively• Tools • RSpec • Bundler • RVM

https://github.com/guiocavalcanti/ruby-101-dev-day

Views

Total views

885

On Slideshare

0

From embeds

0

Number of embeds

3

Actions

Downloads

4

Shares

0

Comments

0

Likes

0

×