ruby
DESCRIPTION
Рассказ о Ruby студентам из Microsoft User Group.TRANSCRIPT
- 1. Ruby
2.
3. 4.
5. 6. 7. 8. 9. , , . , Ruby 10. 11. Perl ,Smalltalk ,Eiffel ,Ada ,Lisp 12. Ruby , , 13.
- ruby code.rb
14. puts "Hello world" 15. >> "Ruby"*2 => "RubyRuby" 16. : User. find ({ 'login'=>'ai' }) ; User. find ( { 'login'=>'ai' } ) User. find{ 'login'=>'ai' } User. find'login'=>'ai' : puts '' if true open 'http://ya.ru' rescue puts ' ' 17. defsum ( a ,b ) a+b end a= iftrue '' else '' end #=> '' 18. [ 1 ,2 ,3 ]. find {| i |i%2==0 }#=> 2 19. 5 . times {| i |puts i } [ 1 ,2 ,3 ]. each{ | i |puts i} [ 1 ,2 ,3 ]. map{ | i |i+1} #=> [2, 3, 4] [ 1 ,2 ,3 ]. inject{ | sum ,i |sum+i} #=> 6 20. -1 . abs ()#=> 1 SomeClass. new #=> 2 .+( 3 )#=> 5 21. class String def /( another ) File. join ( self ,another ) end end 'dir'/'file' #=> "dir/file" 22. . . RSpec describe Usersdo it'should add user'do # empty? true Users. should be_empty Users 3 post= ai. posts . first post . title #=> " " 24. . . Sinatra site.rb get '/post/:id'do post= Post. find ( params [ 'id' ]) haml :post end views/post.haml %html %body %h1 = post .title %p = post .text 25. 3 + 48 + Ruby= 26. :::: Ruby Ruby on Rails. -. Rails ruby-lang.org bit.ly/BPCg3 twitter.com/spbruby