Apresentando Ruby  e Ruby on Rails   a apresentação já vai começar ...
Apresentando Ruby  e Ruby on Rails
Fabio Akitawww.akitaonrails.com  @akitaonrails
Fabio Akitawww.akitaonrails.com  @akitaonrails  1990
Ruby             1994     (linguagem)Ruby on Rails        2004   (framework web)
1.8.7    Ruby          1.9.2                1.9.3-dev                 2.3.11Ruby on Rails     3.0.7                3.1-RC1
1.8.7    Ruby          1.9.2                1.9.3-dev                 2.3.11Ruby on Rails     3.0.7                3.1-RC1
1.8.7    Ruby          1.9.2                1.9.3-dev                 2.3.11Ruby on Rails     3.0.7                3.1-RC1
Orientação a Objetos
UMLDiagrama de Classes
!?       UMLDiagrama de Classes
!?       UMLDiagrama de Classes      POO?
!?       UMLDiagrama de Classes       POC!
Alan Kay“A melhor maneirade prever o futuro   é inventá-lo”
Alan Kay“Eu inventei o termoOrientação a Objetos  e posso dizer que    eu não tinha   C++ em mente”
Alan Kay“Eu inventei o termoOrientação a Objetos  e posso dizer que    eu não tinha   C++ em mente”
Hello World
Hello World
#include <stdio.h>int main(){   printf("Hello worldn");   return 0;}
class HelloWorldApp {    public static void main(String[] args) {        System.out.println("Hello World!");    }}
Transcript show: Hello, world!.
puts Hello World
Procedures??
Procedures??
puts Hello World=> Hello World
puts Hello World=> Hello WorldKernel.puts Hello World=> Hello World
puts Hello World=> Hello WorldKernel.puts Hello World=> Hello Worldputs self.class
puts Hello World=> Hello WorldKernel.puts Hello World=> Hello World                     thisputs self.class
puts Hello World=> Hello WorldKernel.puts Hello World=> Hello World                     thisputs self.class => Object
puts Hello World=> Hello WorldKernel.puts Hello World=> Hello World                     thisputs self.class => ObjectObjec...
puts Hello World=> Hello WorldKernel.puts Hello World=> Hello World                     thisputs self.class => ObjectObjec...
"teste".class => String
"teste".class => String1.class
"teste".class => String1.class => Fixnum
"teste".class => String1.class => Fixnumtrue.class => TrueClass
"teste".class => String1.class => Fixnumtrue.class => TrueClassnil
"teste".class => String1.class => Fixnumtrue.class => TrueClassnil.class => NilClass
"teste".class => String1.class => Fixnumtrue.class => TrueClass                NullPointerException!?nil.class => NilClass
"teste".class => String1.class => Fixnumtrue.class => TrueClassnil.class => NilClass
1 + 2
1 + 21.+(2)
def hello(name)  return "Hello, " + nameendputs hello("Fabio") => "Hello, Fabio"
def hello(name)  return "Hello, " + nameendputs hello "Fabio" => "Hello, Fabio"
def hello(name)  return "Hello, " + nameendputs hello "Fabio" => "Hello, Fabio"                            Parênteses     ...
def hello(name)  "Hello, " + nameendputs hello "Fabio" => "Hello, Fabio"
def hello(name)  "Hello, " + nameendputs hello "Fabio"                       return => "Hello, Fabio"                     ...
def hello(name)  "Hello, #{name}"endputs hello "Fabio" => "Hello, Fabio"
def hello(name)  "Hello, #{name}"endputs hello "Fabio" => "Hello, Fabio"   Interpolação
class String  def hello(name)    "#{self}, #{name}"  endend
class String  def hello(name)    "#{self}, #{name}"  endend"Hello".hello "Fabio" => "Hello, Fabio"
class String  def hello(name)    "#{self}, #{name}"  endend"Hello".hello "Fabio"    Classes => "Hello, Fabio"             ...
module Legal  def bu!    "Buuu!"  endendclass String  include Legalendclass Fixnum  include Legalend"foo".bu! => "Buuu!"10...
module Legal  def bu!    "Buuu!"  endendclass String  include Legalendclass Fixnum  include Legalend"foo".bu! => "Buuu!"10...
module Legal  def bu!    "Buuu!"  endendclass String  include Legalendclass Fixnum                  Module  include Legale...
module Legal  def bu!    "Buuu!"  endendclass String  include Legalendclass Fixnum                  Module  include Legale...
module Legal  def bu!    "Buuu!"  endendclass String  include Legalendclass Fixnum                  Module  include Legale...
require rubygemsrequire active_supportTime.now + 1.day => 2011-05-18 11:44:20 -0300Time.now + 1.week => 2011-05-24 11:44:2...
require rubygemsrequire active_supportTime.now + 1.day => 2011-05-18 11:44:20 -0300Time.now + 1.week => 2011-05-24 11:44:2...
require rubygemsrequire active_supportTime.now + 1.day => 2011-05-18 11:44:20 -0300Time.now + 1.week => 2011-05-24 11:44:2...
require rubygemsrequire active_supportTime.now + 1.day => 2011-05-18 11:44:20 -0300Time.now + 1.week => 2011-05-24 11:44:2...
list = [1,2,3,4,5]soma = 0for i in list  soma += iendputs soma => 15
list = [1,2,3,4,5]soma = 0for i in list  soma += iendputs soma => 15
list = [1,2,3,4,5]soma = 0for i in list  soma += iendputs soma => 15
list = [1,2,3,4,5]soma = list.inject(0) { |total, i| total += i }puts soma => 15
list = [1,2,3,4,5]soma = list.inject(0) { |total, i| total += i }puts soma => 15
list = [1,2,3,4,5]soma = list.inject(0) { |total, i| total += i }puts soma => 15
list = [1,2,3,4,5]soma = list.inject(0) { |total, i| total += i }puts soma => 15
list = [1,2,3,4,5]soma = list.inject(0) { |total, i| total += i }puts soma => 15
list = [1,2,3,4,5]soma = list.inject(0) do |total, i|  total += iendputs soma => 15
list = [1,2,3,4,5]soma = list.inject(0) do |total, i|  total += iendputs soma                    Anonymous => 15          ...
list = [1,2,3,4,5]soma = list.inject(0) do |total, i|  total += iendputs soma => 15
list = [1,2,3,4,5]soma = list.inject(0) do |total, i|  total += iendputs soma => 15                              CLOSURE!
class Foo  def method_missing(method)    print "#{method} called"  endendFoo.new.bar => "bar called"Foo.new.send(:bar) => ...
class Foo  def method_missing(method)    print "#{method} called"  endendFoo.new.bar => "bar called"Foo.new.send(:bar) => ...
class Foo  def method_missing(method)    print "#{method} called"  endendFoo.new.bar => "bar called"Foo.new.send(:bar) => ...
<?xml version="1.1"  encoding="US-ASCII"?><Hello>World!</Hello><date>  <year>2006</year>  <month>01</month>  <day>01</day>...
require builderxml = Builder::XmlMarkup.newxml.instruct! :xml             <?xml version="1.1"                             ...
require builderxml = Builder::XmlMarkup.newxml.instruct! :xml             <?xml version="1.1"                             ...
require builderxml = Builder::XmlMarkup.newxml.instruct! :xml             <?xml version="1.1"                             ...
require builderxml = Builder::XmlMarkup.newxml.instruct! :xml             <?xml version="1.1"                             ...
require builderxml = Builder::XmlMarkup.newxml.instruct! :xml             <?xml version="1.1"                             ...
require rubygemsrequire mechanizea = Mechanize.new do |agent|  agent.user_agent_alias = Mac Safarienda.get(http://google.c...
require rubygemsrequire mechanizea = Mechanize.new do |agent|  agent.user_agent_alias = Mac Safarienda.get(http://google.c...
require rubygemsrequire mechanizea = Mechanize.new do |agent|  agent.user_agent_alias = Mac Safarienda.get(http://google.c...
require rubygemsrequire mechanizea = Mechanize.new do |agent|  agent.user_agent_alias = Mac Safarienda.get(http://google.c...
class Twitter  include HTTParty  base_uri twitter.com  basic_auth username, passwordendTwitter.post(/statuses/update.json,...
class Twitter  include HTTParty  base_uri twitter.com  basic_auth username, passwordendTwitter.post(/statuses/update.json,...
1990                                                                                                                      ...
1990                                                                                                                      ...
1954                                      1957                                            1960                            ...
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
SEMAC 2011 - Apresentando Ruby e Ruby on Rails
Upcoming SlideShare
Loading in …5
×

SEMAC 2011 - Apresentando Ruby e Ruby on Rails

1,127 views
1,098 views

Published on

Apresentação sobre Ruby e Ruby on Rails para o SEMAC da UNESP de São José do Rio Preto.

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

No Downloads
Views
Total views
1,127
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
13
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

SEMAC 2011 - Apresentando Ruby e Ruby on Rails

  1. 1. Apresentando Ruby e Ruby on Rails a apresentação já vai começar ...
  2. 2. Apresentando Ruby e Ruby on Rails
  3. 3. Fabio Akitawww.akitaonrails.com @akitaonrails
  4. 4. Fabio Akitawww.akitaonrails.com @akitaonrails 1990
  5. 5. Ruby 1994 (linguagem)Ruby on Rails 2004 (framework web)
  6. 6. 1.8.7 Ruby 1.9.2 1.9.3-dev 2.3.11Ruby on Rails 3.0.7 3.1-RC1
  7. 7. 1.8.7 Ruby 1.9.2 1.9.3-dev 2.3.11Ruby on Rails 3.0.7 3.1-RC1
  8. 8. 1.8.7 Ruby 1.9.2 1.9.3-dev 2.3.11Ruby on Rails 3.0.7 3.1-RC1
  9. 9. Orientação a Objetos
  10. 10. UMLDiagrama de Classes
  11. 11. !? UMLDiagrama de Classes
  12. 12. !? UMLDiagrama de Classes POO?
  13. 13. !? UMLDiagrama de Classes POC!
  14. 14. Alan Kay“A melhor maneirade prever o futuro é inventá-lo”
  15. 15. Alan Kay“Eu inventei o termoOrientação a Objetos e posso dizer que eu não tinha C++ em mente”
  16. 16. Alan Kay“Eu inventei o termoOrientação a Objetos e posso dizer que eu não tinha C++ em mente”
  17. 17. Hello World
  18. 18. Hello World
  19. 19. #include <stdio.h>int main(){ printf("Hello worldn"); return 0;}
  20. 20. class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); }}
  21. 21. Transcript show: Hello, world!.
  22. 22. puts Hello World
  23. 23. Procedures??
  24. 24. Procedures??
  25. 25. puts Hello World=> Hello World
  26. 26. puts Hello World=> Hello WorldKernel.puts Hello World=> Hello World
  27. 27. puts Hello World=> Hello WorldKernel.puts Hello World=> Hello Worldputs self.class
  28. 28. puts Hello World=> Hello WorldKernel.puts Hello World=> Hello World thisputs self.class
  29. 29. puts Hello World=> Hello WorldKernel.puts Hello World=> Hello World thisputs self.class => Object
  30. 30. puts Hello World=> Hello WorldKernel.puts Hello World=> Hello World thisputs self.class => ObjectObject.ancestors => [Object, Kernel, BasicObject]
  31. 31. puts Hello World=> Hello WorldKernel.puts Hello World=> Hello World thisputs self.class => ObjectObject.ancestors => [Object, Kernel, BasicObject]
  32. 32. "teste".class => String
  33. 33. "teste".class => String1.class
  34. 34. "teste".class => String1.class => Fixnum
  35. 35. "teste".class => String1.class => Fixnumtrue.class => TrueClass
  36. 36. "teste".class => String1.class => Fixnumtrue.class => TrueClassnil
  37. 37. "teste".class => String1.class => Fixnumtrue.class => TrueClassnil.class => NilClass
  38. 38. "teste".class => String1.class => Fixnumtrue.class => TrueClass NullPointerException!?nil.class => NilClass
  39. 39. "teste".class => String1.class => Fixnumtrue.class => TrueClassnil.class => NilClass
  40. 40. 1 + 2
  41. 41. 1 + 21.+(2)
  42. 42. def hello(name) return "Hello, " + nameendputs hello("Fabio") => "Hello, Fabio"
  43. 43. def hello(name) return "Hello, " + nameendputs hello "Fabio" => "Hello, Fabio"
  44. 44. def hello(name) return "Hello, " + nameendputs hello "Fabio" => "Hello, Fabio" Parênteses Opcionais
  45. 45. def hello(name) "Hello, " + nameendputs hello "Fabio" => "Hello, Fabio"
  46. 46. def hello(name) "Hello, " + nameendputs hello "Fabio" return => "Hello, Fabio" automático
  47. 47. def hello(name) "Hello, #{name}"endputs hello "Fabio" => "Hello, Fabio"
  48. 48. def hello(name) "Hello, #{name}"endputs hello "Fabio" => "Hello, Fabio" Interpolação
  49. 49. class String def hello(name) "#{self}, #{name}" endend
  50. 50. class String def hello(name) "#{self}, #{name}" endend"Hello".hello "Fabio" => "Hello, Fabio"
  51. 51. class String def hello(name) "#{self}, #{name}" endend"Hello".hello "Fabio" Classes => "Hello, Fabio" Abertas!
  52. 52. module Legal def bu! "Buuu!" endendclass String include Legalendclass Fixnum include Legalend"foo".bu! => "Buuu!"10.bu! => "Buuu!"
  53. 53. module Legal def bu! "Buuu!" endendclass String include Legalendclass Fixnum include Legalend"foo".bu! => "Buuu!"10.bu! => "Buuu!"
  54. 54. module Legal def bu! "Buuu!" endendclass String include Legalendclass Fixnum Module include Legalend Mixin"foo".bu! => "Buuu!"10.bu! => "Buuu!"
  55. 55. module Legal def bu! "Buuu!" endendclass String include Legalendclass Fixnum Module include Legalend Mixin"foo".bu! => "Buuu!"10.bu! => "Buuu!"
  56. 56. module Legal def bu! "Buuu!" endendclass String include Legalendclass Fixnum Module include Legalend Mixin"foo".bu! => "Buuu!"10.bu! => "Buuu!"
  57. 57. require rubygemsrequire active_supportTime.now + 1.day => 2011-05-18 11:44:20 -0300Time.now + 1.week => 2011-05-24 11:44:24 -0300(1.gigabyte - 100.megabytes) / 1.megabyte => 924
  58. 58. require rubygemsrequire active_supportTime.now + 1.day => 2011-05-18 11:44:20 -0300Time.now + 1.week => 2011-05-24 11:44:24 -0300(1.gigabyte - 100.megabytes) / 1.megabyte => 924
  59. 59. require rubygemsrequire active_supportTime.now + 1.day => 2011-05-18 11:44:20 -0300Time.now + 1.week => 2011-05-24 11:44:24 -0300(1.gigabyte - 100.megabytes) / 1.megabyte => 924
  60. 60. require rubygemsrequire active_supportTime.now + 1.day => 2011-05-18 11:44:20 -0300Time.now + 1.week => 2011-05-24 11:44:24 -0300(1.gigabyte - 100.megabytes) / 1.megabyte => 924
  61. 61. list = [1,2,3,4,5]soma = 0for i in list soma += iendputs soma => 15
  62. 62. list = [1,2,3,4,5]soma = 0for i in list soma += iendputs soma => 15
  63. 63. list = [1,2,3,4,5]soma = 0for i in list soma += iendputs soma => 15
  64. 64. list = [1,2,3,4,5]soma = list.inject(0) { |total, i| total += i }puts soma => 15
  65. 65. list = [1,2,3,4,5]soma = list.inject(0) { |total, i| total += i }puts soma => 15
  66. 66. list = [1,2,3,4,5]soma = list.inject(0) { |total, i| total += i }puts soma => 15
  67. 67. list = [1,2,3,4,5]soma = list.inject(0) { |total, i| total += i }puts soma => 15
  68. 68. list = [1,2,3,4,5]soma = list.inject(0) { |total, i| total += i }puts soma => 15
  69. 69. list = [1,2,3,4,5]soma = list.inject(0) do |total, i| total += iendputs soma => 15
  70. 70. list = [1,2,3,4,5]soma = list.inject(0) do |total, i| total += iendputs soma Anonymous => 15 Inner Class?
  71. 71. list = [1,2,3,4,5]soma = list.inject(0) do |total, i| total += iendputs soma => 15
  72. 72. list = [1,2,3,4,5]soma = list.inject(0) do |total, i| total += iendputs soma => 15 CLOSURE!
  73. 73. class Foo def method_missing(method) print "#{method} called" endendFoo.new.bar => "bar called"Foo.new.send(:bar) => "bar called"
  74. 74. class Foo def method_missing(method) print "#{method} called" endendFoo.new.bar => "bar called"Foo.new.send(:bar) => "bar called"
  75. 75. class Foo def method_missing(method) print "#{method} called" endendFoo.new.bar => "bar called"Foo.new.send(:bar) => "bar called" Messages!
  76. 76. <?xml version="1.1" encoding="US-ASCII"?><Hello>World!</Hello><date> <year>2006</year> <month>01</month> <day>01</day></date>
  77. 77. require builderxml = Builder::XmlMarkup.newxml.instruct! :xml <?xml version="1.1" encoding="US-ASCII"?>xml.Hello "World!" <Hello>World!</Hello>xml.date do <date> xml.year "2006" <year>2006</year> xml.month "01" <month>01</month> xml.day "01" <day>01</day>end </date>
  78. 78. require builderxml = Builder::XmlMarkup.newxml.instruct! :xml <?xml version="1.1" encoding="US-ASCII"?>xml.Hello "World!" <Hello>World!</Hello>xml.date do <date> xml.year "2006" <year>2006</year> xml.month "01" <month>01</month> xml.day "01" <day>01</day>end </date>
  79. 79. require builderxml = Builder::XmlMarkup.newxml.instruct! :xml <?xml version="1.1" encoding="US-ASCII"?>xml.Hello "World!" <Hello>World!</Hello>xml.date do <date> xml.year "2006" <year>2006</year> xml.month "01" <month>01</month> xml.day "01" <day>01</day>end </date>
  80. 80. require builderxml = Builder::XmlMarkup.newxml.instruct! :xml <?xml version="1.1" encoding="US-ASCII"?>xml.Hello "World!" <Hello>World!</Hello>xml.date do <date> xml.year "2006" <year>2006</year> xml.month "01" <month>01</month> xml.day "01" <day>01</day>end </date>
  81. 81. require builderxml = Builder::XmlMarkup.newxml.instruct! :xml <?xml version="1.1" encoding="US-ASCII"?>xml.Hello "World!" <Hello>World!</Hello>xml.date do <date> xml.year "2006" <year>2006</year> xml.month "01" <month>01</month> xml.day "01" <day>01</day>end </date>
  82. 82. require rubygemsrequire mechanizea = Mechanize.new do |agent| agent.user_agent_alias = Mac Safarienda.get(http://google.com/) do |page| search_result = page.form_with(:name => f) do |search| search.q = Hello world end.submit search_result.links.each do |link| puts link.text endend
  83. 83. require rubygemsrequire mechanizea = Mechanize.new do |agent| agent.user_agent_alias = Mac Safarienda.get(http://google.com/) do |page| search_result = page.form_with(:name => f) do |search| search.q = Hello world end.submit search_result.links.each do |link| puts link.text endend
  84. 84. require rubygemsrequire mechanizea = Mechanize.new do |agent| agent.user_agent_alias = Mac Safarienda.get(http://google.com/) do |page| search_result = page.form_with(:name => f) do |search| search.q = Hello world end.submit search_result.links.each do |link| puts link.text endend
  85. 85. require rubygemsrequire mechanizea = Mechanize.new do |agent| agent.user_agent_alias = Mac Safarienda.get(http://google.com/) do |page| search_result = page.form_with(:name => f) do |search| search.q = Hello world end.submit search_result.links.each do |link| puts link.text endend
  86. 86. class Twitter include HTTParty base_uri twitter.com basic_auth username, passwordendTwitter.post(/statuses/update.json, :query => { :status => "Its an HTTParty and everyone is invited!" })
  87. 87. class Twitter include HTTParty base_uri twitter.com basic_auth username, passwordendTwitter.post(/statuses/update.json, :query => { :status => "Its an HTTParty and everyone is invited!" })
  88. 88. 1990 1995 PostScript level 2 PostScript level 3 1992 september 11, 1996 OO Forth Forth 1987986ect Logo Tcl Tcl/Tk1986 mid 1988 end 1988 Fortran 90 ISO 1991 A A+ 1988 1992 J KMPS (FIPS) 1990 MUMPS ISO 1996 M M ANSI Open M 1986 1992 1994 dec 8, 1995 dec 11, 1995 Modula 3 Delphi 1988 march 2, 1995 APL96 1996 ABC 1987 Python Borland 1991 Object Pascal 1985 Turbo Pascal ANSI Rexx f Oberon Oberon-2 1987 1991 Modula-2 ISO Ada 95 june 1, 1996 Ada ISO 1987 1995 NetRexx 1991 ANSI C ISO C ISO C (C89) (C90) (C95) 1989 december 15, 1990 april 1, 1996 JScrip may 19 Cmm LiveScript JavaScript 1992 1995 december 1995 ARM C++ 1989 Oak Java 1 june 1991 may 23, 1995 Ruby february 24, 1993 Ruby 0.95 december 1995 Self Self 4.0 Eiffel Eiffel 2 Eiffel 3 july 10, 1995 Eiffel 4 1986 1988 1993 december 11, 1996 PHP/FI 1995 Sather 0.1 Sather 1.0 Sather 1.1 june 1991 mid-1994 september 1995 Perl 1.000 Perl 2.000 Perl 3.000 Perl 4.000 Perl 5.000ecember 18, 1987 january 5, 1988 october 18, 1989 march 21, 1991 october 18, 1994 Objective Caml 1996sic 1.0 QuickBasic 4.5 MS Basic PDS 7.0 MS PDS 7.1 Visual Basic 3.0 Visual Basic 4.0 1989 Visual Basic 1.0 Visual Basic 2.05 1988 1990 may 20, 1991 march 1992 june 93 september 1995 Clos 1989 Common Lisp ANSI december 8, 1994 Scheme IEEE 1990 Haskell 1.0 Haskell 1.1 Haskell 1.2 Haskell 1.3 1987 april 1, 1990 march 1992 may 1996 SML ‘90 1990ml Caml 2-6.1 Caml 3.187 1991 1993
  89. 89. 1990 1995 PostScript level 2 PostScript level 3 1992 september 11, 1996 OO Forth Forth 1987986ect Logo Tcl Tcl/Tk1986 mid 1988 end 1988 Fortran 90 ISO 1991 A A+ 1988 1992 J KMPS (FIPS) 1990 MUMPS ISO 1996 M M ANSI Open M 1986 1992 1994 dec 8, 1995 dec 11, 1995 Modula 3 Delphi 1988 march 2, 1995 APL96 1996 ABC 1987 Python Borland 1991 Object Pascal 1985 Turbo Pascal ANSI Rexx f Oberon Oberon-2 1987 1991 Modula-2 ISO Ada 95 june 1, 1996 Ada ISO 1987 1995 NetRexx 1991 ANSI C ISO C ISO C (C89) (C90) (C95) 1989 december 15, 1990 april 1, 1996 JScrip may 19 Cmm LiveScript JavaScript 1992 1995 december 1995 ARM C++ 1989 Oak Java 1 june 1991 may 23, 1995 Ruby february 24, 1993 Ruby 0.95 december 1995 Self Self 4.0 Eiffel Eiffel 2 Eiffel 3 july 10, 1995 Eiffel 4 1986 1988 1993 december 11, 1996 PHP/FI 1995 Sather 0.1 Sather 1.0 Sather 1.1 june 1991 mid-1994 september 1995 Perl 1.000 Perl 2.000 Perl 3.000 Perl 4.000 Perl 5.000ecember 18, 1987 january 5, 1988 october 18, 1989 march 21, 1991 october 18, 1994 Objective Caml 1996sic 1.0 QuickBasic 4.5 MS Basic PDS 7.0 MS PDS 7.1 Visual Basic 3.0 Visual Basic 4.0 1989 Visual Basic 1.0 Visual Basic 2.05 1988 1990 may 20, 1991 march 1992 june 93 september 1995 Clos 1989 Common Lisp ANSI december 8, 1994 Scheme IEEE 1990 Haskell 1.0 Haskell 1.1 Haskell 1.2 Haskell 1.3 1987 april 1, 1990 march 1992 may 1996 SML ‘90 1990ml Caml 2-6.1 Caml 3.187 1991 1993
  90. 90. 1954 1957 1960 1965 1970 1975 1980 1985 PostScript 1982 Forth FIG-Forth Forth-83 ANS Forth 1968 1978 1983 1986 Logo Object L 1968 1986 FORTRAN I FORTRAN II FORTRAN III FORTRAN IV FORTRAN IV FORTRAN V FORTRAN (Fortran 66 ANS) (Fortran 77 ANSI) november 1954 october 1956 1957 end-1958 1962 1966 april 1978 Prolog Prolog II Prolog III 1970 october 1982 1984 Sharp APL JOSS TELCOMP MUMPS MUMPS (ANSI) MUMPS ( 1964 1965 1966 september 15, 1977 1986 APL APL 2 1960 august 1984 B 1981 Obj B-O Flow-Matic COBOL COBOL 61 COBOL 61 COBOL COBOL 68 ANS COBOL 74 ANSI COBOL 85 ISO/ANSI 1957 1958 1959 1961 Extended 1965 1968 1974 1985 1962 Rex 1.00 Rex 2.00 Rex 3.00 Rexx 3.20 may 1979 1980 1982 1984 Pascal Pascal AFNOR 1970 1983 PL/M Modula Modula 2 1972 1975 1979 Ada Ada 83 ANSI 1979 january 1983 PL/I PL/1 ANS 1964 1976 Concurrent C 1984 CPL BCPL B C C (K&R) july 1967 1978 Classic C 1963 1969 1971 JOVIAL JOVIAL I JOVIAL II JOVIAL 3 Objective-C 1959 1960 1961 1965 1983 CORAL 64 CORAL 66 C with Classes 1964 1966 C++ april 1980 july 1983 CLU Simula 67 1974 Simula I 1964 1967 ALGOL W Mesa ALGOL 58 ALGOL 60 1966 ALGOL 68 1977 IAL Cedar 1958 1958 1960 december 1983 1968 GOGOL GOGOL III Smalltalk Smalltalk-72 Smalltalk-74 Smalltalk-76 Smalltalk-78 Smalltalk-80 1964 1967 1971 1972 1974 1976 1978 1980 sed Sail 1973 Mainsail 1968 1975 ISWIM awk nawk 1966 1978 1985 KRC 1981 csh SASL october 1978 Per 1976 Miranda decemb 1982 sh 1969 BASIC MS Basic 2.0 BASICA GW-Basic QuickBasic 1.0 may 1, 1964 july 1975 1981 1983 1985 Lisp Lisp 1 Lisp 1.5 Common Lisp 1958 1959 1962 1984 Scheme Scheme MIT Scheme 84 1975 1978 1984 ML SML 1973 1984 SL5 Icon Languages SNOBOL SNOBOL 2 SNOBOL 3 SNOBOL 4 1976 1977 february 27, 2011 Caml 1962 april 1964 1965 1967 1987 ! Éric Lévénez 1999-2011<http://www.levenez.com/lang/> 1 2 3 4

×