[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [patch] Use hash for optional args with long argument list in Ruby bindings

From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: 2007-11-17 06:36:32 CET

Hi

On Nov 16, 2007 9:16 PM, Kouhei Sutou <kou@cozmixng.org> wrote:
> Hi,
>
> In <ae6cb1100711162106g73364c5n46b444d2514f9987@mail.gmail.com>
> "Re: [patch] Use hash for optional args with long argument list in Ruby bindings" on Fri, 16 Nov 2007 21:06:06 -0800,
> "Joe Swatosh" <joe.swatosh@gmail.com> wrote:
>

How about this version?

Index: subversion/bindings/swig/ruby/svn/wc.rb
===================================================================
--- subversion/bindings/swig/ruby/svn/wc.rb (revision 27895)
+++ subversion/bindings/swig/ruby/svn/wc.rb (working copy)
@@ -307,47 +307,44 @@
         editor
       end

- REQUIRED_UPDATE_EDITOR_KEYS = [:target_revision, :target]
- OPTIONAL_UPDATE_EDITOR_KEYS = [:use_commit_times, :depth,
- :allow_unver_obstruction, :diff3_cmd,
- :notify_func, :cancel_func,
- :traversal_info, :preserved_exts]
- def update_editor2(options={})
- default_options = {
- :use_commit_times => true,
- :depth => nil,
- :allow_unver_obstruction => false,
- :diff3_cmd => nil,
- :notify_func => nil,
- :cancel_func => nil,
- :traversal_info => _traversal_info,
- :preserved_exts => []
- }
- options = default_options.merge(options)
- Util.validate_options(options,
- OPTIONAL_UPDATE_EDITOR_KEYS,
- REQUIRED_UPDATE_EDITOR_KEYS)
+ UPDATE_EDITOR2_REQUIRED_ARGUMENTS_KEYS = [:target_revision, :target]
+ def update_editor2(arguments={})
+ optional_arguments_defaults = {
+ :use_commit_times => true,
+ :depth => nil,
+ :allow_unver_obstruction => false,
+ :diff3_cmd => nil,
+ :notify_func => nil,
+ :cancel_func => nil,
+ :traversal_info => _traversal_info,
+ :preserved_exts => []
+ }

+ arguments = optional_arguments_defaults.merge(arguments)
+ Util.validate_options(arguments,
+ optional_arguments_defaults.keys,
+ UPDATE_EDITOR2_REQUIRED_ARGUMENTS_KEYS)
+
         # TODO(rb support fetch_fun): implement support for the fetch_func
         # callback.
- options[:fetch_func] = nil
+ arguments[:fetch_func] = nil

         # TODO(rb support conflict_fun): implement support for the
         # conflict_func callback.
- options[:conflict_func] = nil
+ arguments[:conflict_func] = nil

- results = Wc.get_update_editor3(options[:target_revision], self,
- options[:target],
- options[:use_commit_times],
- options[:depth],
- options[:allow_unver_obstruction],
- options[:notify_func],
- options[:cancel_func],
- options[:conflict_func],
- options[:fetch_func],
- options[:diff3_cmd],
- options[:preserved_exts],
- options[:traversal_info])
+ results = Wc.get_update_editor3(arguments[:target_revision], self,
+ arguments[:target],
+ arguments[:use_commit_times],
+ arguments[:depth],
+ arguments[:allow_unver_obstruction],
+ arguments[:notify_func],
+ arguments[:cancel_func],
+ arguments[:conflict_func],
+ arguments[:fetch_func],
+ arguments[:diff3_cmd],
+ arguments[:preserved_exts],
+ arguments[:traversal_info])
         target_revision_address, editor, editor_baton = results
         editor.__send__(:target_revision_address=, target_revision_address)
         editor.baton = editor_baton

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Nov 17 06:36:42 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.