On 2017/08/28 16:54, glass / ruby-lang.org wrote:> glass    2017-08-28
16:54:00 +0900 (Mon, 28 Aug 2017)
>
>   New Revision: 59671
>
>   https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59671
>
>   Log:
>     lib/csv.rb: refactor and optimize. This change
>     includes the patch from marshall-lee.
>     close #1168
Is a keyword hash faster than a keyword argument?

@@ -1188,11 +1189,11 @@
   # The <tt>:row_sep</tt> +option+ defaults to <tt>$INPUT_RECORD_SEPARATOR</tt>
   # (<tt>$/</tt>) when calling this method.
   #
-  def self.generate_line(row, encoding: nil, **options)
+  def self.generate_line(row, **options)
     options = {row_sep: $INPUT_RECORD_SEPARATOR}.merge(options)
     str = String.new
-    if encoding
-      str.force_encoding(encoding)
+    if options[:encoding]
+      str.force_encoding(options[:encoding])
     elsif field = row.find { |f| not f.nil? }
       str.force_encoding(String(field).encoding)
     end

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>