Advertisement
Advertisement

More Related Content

Advertisement

AITP Ruby And Rails Talk

  1. Ruby and Rails Jason Dew
  2. Ruby
  3. pure OO
  4. 42.methods.sort
  5. beautiful
  6. def fib n return 0 unless n > 0 return 1 if [1,2].include? n fib(n-1) + fib(n-2) end puts fib(10) # => 55
  7. Symbols
  8. roygbiv = [:red, :orange, :yellow, :green, :blue, :indigo, :violet] some_hash = { :bar => bar, :life => 42 }
  9. blocks
  10. array = [42, bar, [x]] result = array.map do |element| element * 2 end puts result.inspect # => [84, barbar, [x, x]]
  11. classes
Advertisement