SlideShare a Scribd company logo
Ruby 1.9.3

                  Kenta Murata




2011   7   3                     1
2011   7   3   2
2011
2010   7
       3   3
           1   3
Ruby 1.9.3

                  Kenta Murata




2011   7   3                     4
• ruby   NEWS


                               (   )




2011   7   3                           5
•           NEWS



               •   ruby_1_9_3
                                NEWS




2011   7   3                           6
!
   W
NE

               ARGF.read_nonblock


               • ARGF.read_nonblock(maxlen)
               • ARGF.read_nonblock(maxlen, outbuf)


2011   7   3                                          7
!
   W
NE

               ARGF.to_write_io

               •
                   IO

               •            IOError




2011   7   3                          8
!
   W
NE

                      ARGF.write

               • ARGF.write(str)
               •                           str
                     ARGF.to_write_io.write(str)




2011   7   3                                       9
!
   W
NE

               ARGF
               • ARGF.print
               • ARGF.printf
               • ARGF.putc
               • ARGF.puts
               • IO
                 ARGF.write


2011   7   3                   10
!                     Array#pack,
   W
NE


                         String#unpack
               •
                   ‘<’    ‘>’

                 S>, L>, Q>, s>, l>, q>,      ‘>’
               S!>, L!>, Q!>, s!>, l!>, q!>

                 S<, L<, Q<, s<, l<, q<,      ‘<’
               S!<, L!<, Q!<, s!<, l!<, q!<



2011   7   3                                        11
!
     ed
   ov
 pr


                           Bignum
Im




               •   1,500   (          150   )


                               (Toom-3)




2011   7   3                                    12
!
   W
NE




               • CP950 (Big5)
               • CP951 (BIg5HKSCS)
               • UTF-16
               • UTF-32

2011   7   3                         13
!
           ed
   ng
   a
Ch




                  • SJIS    Windows-31J



                  • 1.9.2        Shift_JIS




2011   7   3                                 14
!
   W
NE

                     File::NULL

               • NULL
               • UNIX      “/dev/null”

               • Windows      “NUL”




2011   7   3                             15
!
     ed
   ov
 pr


                              IO#putc
Im




               •
               • putc “   ”             !




2011   7   3                                16
!
   W
NE

                        IO#advise
               • IO#advise(advise, offset=0, len=0)
               • posix_fadvise(2)
                                                      OS



               • posix_fadvise(2)

2011   7   3                                               17
!
   W
NE

                           IO.write

               • IO.write(name, string, offset=0, opts={})
               •           name              string
                 offset
                                 opts

               • IO.read

2011   7   3                                                 18
!
   W
NE

                       IO.binwrite

               • IO.binwrite(name, string, offset=0, opts={})
               • IO.write
               •                        “wb:ASCII-8BIT”




2011   7   3                                                    19
!
           ed
   ng


               BasicObject#__id__
   a
Ch




                  • Object BasicObject
                  • [ruby-dev:42778]


2011   7   3                             20
!
     ed
                    Kernel#rand,
   ov
 pr
Im




                    Random.rand
               • Kernel#rand(range)
               • Random.rand(range)
               •
                                           OK

               • [ruby-dev:43427], #4605

2011   7   3                                    21
!
   W
               Module#private_constant,
NE


               Module#public_constant


               •
               •



2011   7   3                              22
!
   W
NE

                 String#prepend

               • String#prepend(str)
               •         str



               • recv[0,0] = str       (
                      )



2011   7   3                               23
!
   W
NE

                 String#byteslice
               • String#byteslice(n)
               • String#byteslice(beg, end)
               • String#slice
               •


2011   7   3                                  24
!
     ed
   ov
 pr


                  Time#strftime
Im




               •
               • %:z    %H:%M

               • %::z   %H:%M:%S




2011   7   3                       25
!          Process#maxgroups,
   W
NE


               Process#maxgroups


               •



2011   7   3                        26
!
     ed
   ov
                BigDecimal.new,
 pr
Im




               Kernel#BigDecimal

               •       Integer    Rational   Float



               •       Rational    Float
                   2




2011   7   3                                         27
!
     ed
   ov
 pr


               BigDecimal#coerce
Im




               • Rational         BigDecimal
                         coerce
                 BigDecimal

               • 1.9.2               Rational   Float




2011   7   3                                            28
!
           ed
                        BigMath.exp,
   ng
   a
Ch




                        BigMath.log

                  • bigdecimal/math   bigdecimal



                  •C


2011   7   3                                       29
!
     ed
   ov
 pr


                  BigDecimal#**
Im




               • BigDecimal
                        (     )




2011   7   3                      30
!
     ed
   ov
 pr


               DateTime
Im




               •   DateTime.new   Float
                   Rational

               •



2011   7   3                              31
!
     ed
   ov
                    DateTime#+,
 pr
Im




                    DateTime#-
               • DateTime   Float



               •        Float




2011   7   3                        32
date
               •

               •                    strftime
                   (Time#strftime              )

               •   inspect

               •   marshal




2011   7   3                                       33
!
   W
NE

               io/console
               •   IO#noecho {|io} ... }

               •   IO#echo=

               •   IO#echo?

               •   IO#raw {|io| ... }

               •   IO#raw!

               •   IO#getch

               •   IO#winsize

               •   IO.console


2011   7   3                               34
!
   W
NE

                    Matrix
               •   Matrix#diagnoal? --

               •   Matrix#hermitian? --

               •   Matrix#normal? --

               •   Matrix#orthogonal? --

               •   Matrix#permutation? --

               •   Matrix#symmetric? --

               •   Matrix#unitary? --

               •   Matrix#zero? --



2011   7   3                                35
!                  Matrix#eigen,
   W
NE


               Matrix#eigensystem
               •
               • v, d, v_inv = matrix.eigen
                 • v, v_inv :
                 • d:
                 • (v * d * v_inv).round(5) == matrix
2011   7   3                                            36
!
   W
                      Matrix#lup
NE


               Matrix#lup_decomposition



               •                      LUP

               • l, u, p = matrix.lup


2011   7   3                                37
!
   W
NE

                   Matrix#round

               • Matrix#round(n=0)
               •                     n




2011   7   3                             38
!
   W
NE

               Vector#magnitude


               •



2011   7   3                      39
Matrix#each,
               Matrix#each_with_index
               • Matrix#each(mode=:all)
               • each
               :all
               :diagonal
               :off_diagonal
               :lower
               :strict_lower
               :strict_upper
               :upper




2011   7   3                              40
:all
                                    
                 0   0    0     0   0
               0    0    0     0   0
               
               0    0    0     0   0
               
               0    0    0     0   0
                 0   0    0     0   0

2011   7   3                              41
:diagonal
                                  
                 0    0   0   0   0
               0     0   0   0   0
               
               0     0   0   0   0
               
               0     0   0   0   0
                 0    0   0   0   0

2011   7   3                            42
:off_diagonal
                                 
                 0   0   0   0   0
               0    0   0   0   0
               
               0    0   0   0   0
               
               0    0   0   0   0
                 0   0   0   0   0

2011   7   3                           43
:lower
                                 
                 0   0   0   0   0
               0    0   0   0   0
               
               0    0   0   0   0
               
               0    0   0   0   0
                 0   0   0   0   0

2011   7   3                           44
:strict_lower
                                 
                 0   0   0   0   0
               0    0   0   0   0
               
               0    0   0   0   0
               
               0    0   0   0   0
                 0   0   0   0   0

2011   7   3                           45
:strict_upper
                                 
                 0   0   0   0   0
               0    0   0   0   0
               
               0    0   0   0   0
               
               0    0   0   0   0
                 0   0   0   0   0

2011   7   3                           46
:upper
                                 
                 0   0   0   0   0
               0    0   0   0   0
               
               0    0   0   0   0
               
               0    0   0   0   0
                 0   0   0   0   0

2011   7   3                           47
!
     ed
               Matrix#find_index,
   ov
 pr
Im




                 Matrix#index
               •   Matrix#index(val, selector=:all)
               •   val                    [row, column]

               •   Matrix#index(selector=:all) {|val| ... }
               •
               •   Matrix#index(selector=:all)
               •   Enumerator


2011   7   3                                                  48
!
     ed
   ov
 pr


                      Matrix.zero
Im




               • Matrix.zero(row_size, col_size=row_size)
               •


2011   7   3                                                49
!
     ed
   ov
 pr


                         net/http
Im




               • Server Name Indication              (
                     )

               • 100 continue      (          )

               • Net::HTTPRequest#set_form
                 application/x-www-form-urlencoded
                 multipart/form-data

2011   7   3                                             50
!
     ed
   ov
 pr


                            webrick
Im




               • WEBrick::HTTPRequest#continue   100
                 continue



               • “%{remote}p”


2011   7   3                                           51
!
     ed
   ov
 pr


                   openssl
Im




               •



2011   7   3                 52
!
     ed
   ov
 pr


                        optparse
Im




               • bash   zsh        l




2011   7   3                           53
!
     ed
   ov
 pr


                           Rake
Im




               •          0.9.2.1

               • 1.9.2   0.8.7




2011   7   3                        54
!
     ed
   ov
 pr


                         RDoc
Im




               •         3.8

               • 1.9.2         2.5.8




2011   7   3                           55
!
     ed
   ov
 pr


                              rexml
Im




               •   iconv                  Ruby



               •   Document#encoding XMLDecl#encoding
                   Output#encoding Source#encoding
                                           Encoding




2011   7   3                                            56
!
     ed
   ov
 pr


                   Rubygems
Im




               •    1.5.0




2011   7   3                  57
!
     ed
   ov
 pr


                            stringio
Im




               • StringIO#set_encoding
                   (IO#set_encoding      )

               •

2011   7   3                                 58
!
     ed
   ov
 pr


                   test/unit
Im




               •
               •



2011   7   3                   59
!
     ed
   ov
 pr


                               uri
Im




               • URI::Generic#hostname
                 URI::Generic#hostname=




2011   7   3                              60
!
           ed
   ng


                                  yaml
   a
Ch




                  •                YAML                  Psych



                  •                     syck
                                                     :
                      YAML::ENGINE.yamler = ‘syck’



2011   7   3                                                     61
!
     ed
   ov
 pr


                                 zlib
Im




               • Zlib::Deflate.deflate
                 Zlib.deflate

               • Zlib::Inflate.inflate
                 Zlib.inflate



2011   7   3                            62
!
     ed
   ov
 pr


                            fileutils
Im




               • FileUtils.chmod              chmod(1)




               •                :
                   FileUtils.chmod “u=wrx,go=rx”, filename




2011   7   3                                                63
!
     ed
   ov
 pr
Im




               •   Regexp     Unicode 6.0

               •   Regexp                Unicode     Age



               •                           warn-indent: true


                     ) -*- warn-indent: true -*-
                     ) -*- warn-indent: false -*-


2011   7   3                                                   64
•
                     NEWS



               • Ruby 1.9.3


2011   7   3                  65

More Related Content

Ruby 1.9.3 の新機能と変更点

  • 1. Ruby 1.9.3 Kenta Murata 2011 7 3 1
  • 2. 2011 7 3 2
  • 3. 2011 2010 7 3 3 1 3
  • 4. Ruby 1.9.3 Kenta Murata 2011 7 3 4
  • 5. • ruby NEWS ( ) 2011 7 3 5
  • 6. NEWS • ruby_1_9_3 NEWS 2011 7 3 6
  • 7. ! W NE ARGF.read_nonblock • ARGF.read_nonblock(maxlen) • ARGF.read_nonblock(maxlen, outbuf) 2011 7 3 7
  • 8. ! W NE ARGF.to_write_io • IO • IOError 2011 7 3 8
  • 9. ! W NE ARGF.write • ARGF.write(str) • str ARGF.to_write_io.write(str) 2011 7 3 9
  • 10. ! W NE ARGF • ARGF.print • ARGF.printf • ARGF.putc • ARGF.puts • IO ARGF.write 2011 7 3 10
  • 11. ! Array#pack, W NE String#unpack • ‘<’ ‘>’ S>, L>, Q>, s>, l>, q>, ‘>’ S!>, L!>, Q!>, s!>, l!>, q!> S<, L<, Q<, s<, l<, q<, ‘<’ S!<, L!<, Q!<, s!<, l!<, q!< 2011 7 3 11
  • 12. ! ed ov pr Bignum Im • 1,500 ( 150 ) (Toom-3) 2011 7 3 12
  • 13. ! W NE • CP950 (Big5) • CP951 (BIg5HKSCS) • UTF-16 • UTF-32 2011 7 3 13
  • 14. ! ed ng a Ch • SJIS Windows-31J • 1.9.2 Shift_JIS 2011 7 3 14
  • 15. ! W NE File::NULL • NULL • UNIX “/dev/null” • Windows “NUL” 2011 7 3 15
  • 16. ! ed ov pr IO#putc Im • • putc “ ” ! 2011 7 3 16
  • 17. ! W NE IO#advise • IO#advise(advise, offset=0, len=0) • posix_fadvise(2) OS • posix_fadvise(2) 2011 7 3 17
  • 18. ! W NE IO.write • IO.write(name, string, offset=0, opts={}) • name string offset opts • IO.read 2011 7 3 18
  • 19. ! W NE IO.binwrite • IO.binwrite(name, string, offset=0, opts={}) • IO.write • “wb:ASCII-8BIT” 2011 7 3 19
  • 20. ! ed ng BasicObject#__id__ a Ch • Object BasicObject • [ruby-dev:42778] 2011 7 3 20
  • 21. ! ed Kernel#rand, ov pr Im Random.rand • Kernel#rand(range) • Random.rand(range) • OK • [ruby-dev:43427], #4605 2011 7 3 21
  • 22. ! W Module#private_constant, NE Module#public_constant • • 2011 7 3 22
  • 23. ! W NE String#prepend • String#prepend(str) • str • recv[0,0] = str ( ) 2011 7 3 23
  • 24. ! W NE String#byteslice • String#byteslice(n) • String#byteslice(beg, end) • String#slice • 2011 7 3 24
  • 25. ! ed ov pr Time#strftime Im • • %:z %H:%M • %::z %H:%M:%S 2011 7 3 25
  • 26. ! Process#maxgroups, W NE Process#maxgroups • 2011 7 3 26
  • 27. ! ed ov BigDecimal.new, pr Im Kernel#BigDecimal • Integer Rational Float • Rational Float 2 2011 7 3 27
  • 28. ! ed ov pr BigDecimal#coerce Im • Rational BigDecimal coerce BigDecimal • 1.9.2 Rational Float 2011 7 3 28
  • 29. ! ed BigMath.exp, ng a Ch BigMath.log • bigdecimal/math bigdecimal •C 2011 7 3 29
  • 30. ! ed ov pr BigDecimal#** Im • BigDecimal ( ) 2011 7 3 30
  • 31. ! ed ov pr DateTime Im • DateTime.new Float Rational • 2011 7 3 31
  • 32. ! ed ov DateTime#+, pr Im DateTime#- • DateTime Float • Float 2011 7 3 32
  • 33. date • • strftime (Time#strftime ) • inspect • marshal 2011 7 3 33
  • 34. ! W NE io/console • IO#noecho {|io} ... } • IO#echo= • IO#echo? • IO#raw {|io| ... } • IO#raw! • IO#getch • IO#winsize • IO.console 2011 7 3 34
  • 35. ! W NE Matrix • Matrix#diagnoal? -- • Matrix#hermitian? -- • Matrix#normal? -- • Matrix#orthogonal? -- • Matrix#permutation? -- • Matrix#symmetric? -- • Matrix#unitary? -- • Matrix#zero? -- 2011 7 3 35
  • 36. ! Matrix#eigen, W NE Matrix#eigensystem • • v, d, v_inv = matrix.eigen • v, v_inv : • d: • (v * d * v_inv).round(5) == matrix 2011 7 3 36
  • 37. ! W Matrix#lup NE Matrix#lup_decomposition • LUP • l, u, p = matrix.lup 2011 7 3 37
  • 38. ! W NE Matrix#round • Matrix#round(n=0) • n 2011 7 3 38
  • 39. ! W NE Vector#magnitude • 2011 7 3 39
  • 40. Matrix#each, Matrix#each_with_index • Matrix#each(mode=:all) • each :all :diagonal :off_diagonal :lower :strict_lower :strict_upper :upper 2011 7 3 40
  • 41. :all   0 0 0 0 0 0 0 0 0 0  0 0 0 0 0  0 0 0 0 0 0 0 0 0 0 2011 7 3 41
  • 42. :diagonal   0 0 0 0 0 0 0 0 0 0  0 0 0 0 0  0 0 0 0 0 0 0 0 0 0 2011 7 3 42
  • 43. :off_diagonal   0 0 0 0 0 0 0 0 0 0  0 0 0 0 0  0 0 0 0 0 0 0 0 0 0 2011 7 3 43
  • 44. :lower   0 0 0 0 0 0 0 0 0 0  0 0 0 0 0  0 0 0 0 0 0 0 0 0 0 2011 7 3 44
  • 45. :strict_lower   0 0 0 0 0 0 0 0 0 0  0 0 0 0 0  0 0 0 0 0 0 0 0 0 0 2011 7 3 45
  • 46. :strict_upper   0 0 0 0 0 0 0 0 0 0  0 0 0 0 0  0 0 0 0 0 0 0 0 0 0 2011 7 3 46
  • 47. :upper   0 0 0 0 0 0 0 0 0 0  0 0 0 0 0  0 0 0 0 0 0 0 0 0 0 2011 7 3 47
  • 48. ! ed Matrix#find_index, ov pr Im Matrix#index • Matrix#index(val, selector=:all) • val [row, column] • Matrix#index(selector=:all) {|val| ... } • • Matrix#index(selector=:all) • Enumerator 2011 7 3 48
  • 49. ! ed ov pr Matrix.zero Im • Matrix.zero(row_size, col_size=row_size) • 2011 7 3 49
  • 50. ! ed ov pr net/http Im • Server Name Indication ( ) • 100 continue ( ) • Net::HTTPRequest#set_form application/x-www-form-urlencoded multipart/form-data 2011 7 3 50
  • 51. ! ed ov pr webrick Im • WEBrick::HTTPRequest#continue 100 continue • “%{remote}p” 2011 7 3 51
  • 52. ! ed ov pr openssl Im • 2011 7 3 52
  • 53. ! ed ov pr optparse Im • bash zsh l 2011 7 3 53
  • 54. ! ed ov pr Rake Im • 0.9.2.1 • 1.9.2 0.8.7 2011 7 3 54
  • 55. ! ed ov pr RDoc Im • 3.8 • 1.9.2 2.5.8 2011 7 3 55
  • 56. ! ed ov pr rexml Im • iconv Ruby • Document#encoding XMLDecl#encoding Output#encoding Source#encoding Encoding 2011 7 3 56
  • 57. ! ed ov pr Rubygems Im • 1.5.0 2011 7 3 57
  • 58. ! ed ov pr stringio Im • StringIO#set_encoding (IO#set_encoding ) • 2011 7 3 58
  • 59. ! ed ov pr test/unit Im • • 2011 7 3 59
  • 60. ! ed ov pr uri Im • URI::Generic#hostname URI::Generic#hostname= 2011 7 3 60
  • 61. ! ed ng yaml a Ch • YAML Psych • syck : YAML::ENGINE.yamler = ‘syck’ 2011 7 3 61
  • 62. ! ed ov pr zlib Im • Zlib::Deflate.deflate Zlib.deflate • Zlib::Inflate.inflate Zlib.inflate 2011 7 3 62
  • 63. ! ed ov pr fileutils Im • FileUtils.chmod chmod(1) • : FileUtils.chmod “u=wrx,go=rx”, filename 2011 7 3 63
  • 64. ! ed ov pr Im • Regexp Unicode 6.0 • Regexp Unicode Age • warn-indent: true ) -*- warn-indent: true -*- ) -*- warn-indent: false -*- 2011 7 3 64
  • 65. NEWS • Ruby 1.9.3 2011 7 3 65