Seja Feliz com Ruby!

236 views

Published on

Palestra apresentada no 1º encontro ABCoDes no ITESCS - Instituto de Tecnologia de São Caetano do Sul.

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

  • Be the first to like this

No Downloads
Views
Total views
236
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Seja Feliz com Ruby!

  1. 1. sejafelizcom ruby
  2. 2. lucas renan
  3. 3. nu
  4. 4. guru sorocaba
  5. 5. sad panda
  6. 6. yukihiro matsumoto
  7. 7. perl,smalltalk, eiffel,ada,lisp
  8. 8. rubypermiteque vocêsejafeliz
  9. 9. uhull,valeumatz:)
  10. 10. 5.times { puts "We love Ruby" }
  11. 11. puramente orientadaaobjetos
  12. 12. 1.class # => Fixnum
  13. 13. 1.class # => Fixnum "ruby".class # => String
  14. 14. 1.class # => Fixnum "ruby".class # => String 1.to_s.class # => String
  15. 15. rubypermiteque vocêescrevacódigo elegante
  16. 16. class Person end person = Person.new
  17. 17. class Person attr_accessor :name end person = Person.new person.name = "lucas"
  18. 18. class Person attr_accessor :name, :age end person = Person.new person.name = "lucas" person.age = 24 puts person.age # => 24
  19. 19. class Person attr_accessor :name, :age def is_adult? @age > 18 end end person = Person.new person.name = "lucas" person.age = 24 puts person.is_adult? # => true
  20. 20. activesupport
  21. 21. require "active_support/all" 1.day.ago # => 2013-08-09 00:00:00 -0300
  22. 22. require "active_support/all" 1.day.ago # => 2013-08-09 00:00:00 -0300 Date.today.beginning_of_month # => Thu, 01 Aug 2013
  23. 23. require "active_support/all" 1.day.ago # => 2013-08-09 00:00:00 -0300 Date.today.beginning_of_month # => Thu, 01 Aug 2013 [1, 2, 3].sum # => 6
  24. 24. metaprogramming
  25. 25. klass = Class.new do end Person = klass Person.name # => Person
  26. 26. klass = Class.new do end Person = klass Person.name # => Person person = Person.new
  27. 27. klass = Class.new do ["say", "scream"].each do |method| define_method method do |message| "#{method}ing: #{message}" end end end Person = klass Person.name # => Person person = Person.new puts person.say "ruby" # => saying: ruby puts person.scream "ruby <3" # => screaming: ruby <3
  28. 28. instalação
  29. 29. atéquandovocê vaificartriste?
  30. 30. obrigado:)

×