From: maven apache Date: 2012-02-12T21:36:42+09:00 Subject: the ruby syntax --20cf30334f23c2bcfe04b8c39b93 Content-Type: text/plain; charset=ISO-8859-1 Hi: I like ruby the first time I read its document. However then I found that the syntax is too fliexible to learn it. For example: The IO.open method,this is the api page: http://ruby-doc.org/core-1.9.3/IO.html#method-c-new This is the argument of this method: new(fd [, mode] [, opt]) I am confused by the third argument-'opt'. Is its type is 'hash'?? If so I think this is the way to call it: IO>new("data.txt", "w",{:encoding=>'xxx',:autoclose=>true...}) But I found so many people call it like this: IO.new("data.txt", mode: 'w:UTF-16LE', cr_newline: true) What does this mean? 'data.txt' is the first argument. How about the others? which is the second? and which is the third? ------------------------------- BTW, the above is just an example,in fact I found so many syntax that I can not understand. So I wonder if there is any documents cover all of ruby's *fiexible* syntax? --20cf30334f23c2bcfe04b8c39b93--