Kazuya NUMATA
for OSC-Do 2010 / Jun 26 2010
•                           ( Kazuya NUMATA)
    •
    •                       LOCAL

    •               4               ...
Ruby
open(“/home/kaz/hogehoge.txt”) do |f|
     f.each do |line|
           print line
     end
end #
[5, 6, 2, 26, 4].sort
        => [2, 4, 5, 6, 26]
(   )
        [5, 6, 2, 3, 5, 2].uniq
        => [5, 6, 2, 3]

        [...
3.times { print “hello” }
3
    => “hellohellohello”
[2, 5, 1, 3, 9].map { |i| i * 3 }

=> [6, 15, 3, 9, 27]
Ruby on Rails
                 ActiveRecord
RubyGems         ActiveSupport
                       ....


           $ sudo...
25.minutes.ago
                         == Time.now - 25 * 60


Time.days_in_month(11)
                                == ...
Java(Struts + Spring) ...


public ActionForward edit(ActionMapping mapping, ActionForm form,
                            ...
But on “Ruby on Rails”,




            def edit
                @person = Person.find(params[:id])
            end




  ...
↓

↓
Matz Ruby (C Ruby)
     jRuby (Java    Ruby)
   IronRuby (.NET     Ruby)
  RubyCocoa/Mac Ruby (Mac)
Rubinius (Ruby        ...
(   )
Test::Unit / rspec / cucumber

          autotest
(   )
Thank you :)
Rubyで踏み出そう、次の一歩/The next step with Ruby
Rubyで踏み出そう、次の一歩/The next step with Ruby
Rubyで踏み出そう、次の一歩/The next step with Ruby
Rubyで踏み出そう、次の一歩/The next step with Ruby
Rubyで踏み出そう、次の一歩/The next step with Ruby
Rubyで踏み出そう、次の一歩/The next step with Ruby
Upcoming SlideShare
Loading in …5
×

Rubyで踏み出そう、次の一歩/The next step with Ruby

2,118 views

Published on

初心者向けにRubyについて紹介しています。
(ターゲットの絞り込みが甘いため、内容的にブレがあります)

Published in: Technology
  • Be the first to comment

Rubyで踏み出そう、次の一歩/The next step with Ruby

  1. 1. Kazuya NUMATA for OSC-Do 2010 / Jun 26 2010
  2. 2. • ( Kazuya NUMATA) • • LOCAL • 4 CA • • • • twitter: @kaznum • Ruby 10 ?
  3. 3. Ruby
  4. 4. open(“/home/kaz/hogehoge.txt”) do |f| f.each do |line| print line end end #
  5. 5. [5, 6, 2, 26, 4].sort => [2, 4, 5, 6, 26] ( ) [5, 6, 2, 3, 5, 2].uniq => [5, 6, 2, 3] [5, 6, 2, 3, 5, 2].uniq.sort => [2, 3, 5, 6]
  6. 6. 3.times { print “hello” } 3 => “hellohellohello”
  7. 7. [2, 5, 1, 3, 9].map { |i| i * 3 } => [6, 15, 3, 9, 27]
  8. 8. Ruby on Rails ActiveRecord RubyGems ActiveSupport .... $ sudo gem install <gem >
  9. 9. 25.minutes.ago == Time.now - 25 * 60 Time.days_in_month(11) == 30
  10. 10. Java(Struts + Spring) ... public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PersonForm personForm = (PersonForm) form; if (personForm.getId() != null) { PersonManager mgr = (PersonManager) getBean("personManager"); Person person = mgr.getPerson(personForm.getId()); personForm = (PersonForm) convert(person); updateFormBean(mapping, request, personForm); } return mapping.findForward("edit"); } http://www.relevancellc.com/blog/2007/05/12/static-typing-and-readable-code.html
  11. 11. But on “Ruby on Rails”, def edit @person = Person.find(params[:id]) end http://www.relevancellc.com/blog/2007/05/12/static-typing-and-readable-code.html
  12. 12. ↓ ↓
  13. 13. Matz Ruby (C Ruby) jRuby (Java Ruby) IronRuby (.NET Ruby) RubyCocoa/Mac Ruby (Mac) Rubinius (Ruby Ruby) ...
  14. 14. ( )
  15. 15. Test::Unit / rspec / cucumber autotest
  16. 16. ( )
  17. 17. Thank you :)

×