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

Re: [PATCH] Add some RDoc comments to the SWIG/Ruby bindings, part 1

From: Kobayashi Noritada <nori1_at_dolphin.c.u-tokyo.ac.jp>
Date: 2006-06-25 13:55:30 CEST

Hi,

> > + # Following methods are also available:
> > + #
> > + # [created_rev]
> > + # Returns a revision at which the instance was last modified.
> > + # [has_props]
> > + # Returns true if the instance has properties.
> > + # [last_author]
> > + # Returns an author who last modified the instance.
> > + # [size]
> > + # Returns a size of the instance.
> > class Dirent
>
> We should provide have_props? method instead of has_props to make
> the bindings more Rubyish. Could you add a new alias and update
> the corresponded commet after you commit?

All right, here is a patch to do so. It also provides tests for that
method. Could you please review it?

Thanks,

-nori

[[[
Make a method name more Rubyish in the SWIG/Ruby bindings.

* subversion/bindings/swig/ruby/svn/core.rb
  (Svn::Core::Dirent#have_props?): A new alias to
  Svn::Core::Dirent#has_props.
  (Svn::Core::Dirent): Replace a descripsion for
  Svn::Core::Dirent#has_props by one for Svn::Core::Dirent#have_props?
  in the RDoc comment.

* subversion/bindings/swig/ruby/test/test_client.rb
  (SvnClientTest#test_list): Add assertions for
  Svn::Core::Dirent#have_props?.

Suggested by: kou
]]]

Index: subversion/bindings/swig/ruby/test/test_client.rb
===================================================================
--- subversion/bindings/swig/ruby/test/test_client.rb (revision 20239)
+++ subversion/bindings/swig/ruby/test/test_client.rb (working copy)
@@ -1516,6 +1516,8 @@
     src = "source\n"
     file = "sample.txt"
     dir = "sample"
+ prop_name = "sample-prop"
+ prop_value = "sample value"
     dir_path = File.join(@wc_path, dir)
     path = File.join(@wc_path, file)
 
@@ -1524,6 +1526,7 @@
     ctx.mkdir(dir_path)
     File.open(path, "w") {|f| f.print(src)}
     ctx.add(path)
+ ctx.prop_set(prop_name, prop_value, path)
     rev = ctx.ci(@wc_path).revision
 
     entries = []
@@ -1538,8 +1541,10 @@
       case path
       when dir, ""
         assert(dirent.directory?)
+ assert_false(dirent.have_props?)
       when file
         assert(dirent.file?)
+ assert_true(dirent.have_props?)
       else
         flunk
       end
Index: subversion/bindings/swig/ruby/svn/core.rb
===================================================================
--- subversion/bindings/swig/ruby/svn/core.rb (revision 20239)
+++ subversion/bindings/swig/ruby/svn/core.rb (working copy)
@@ -323,8 +323,8 @@
     #
     # [created_rev]
     # Returns a revision at which the instance was last modified.
- # [has_props]
- # Returns true if the instance has properties.
+ # [have_props?]
+ # Returns +true+ if the instance has properties.
     # [last_author]
     # Returns an author who last modified the instance.
     # [size]
@@ -356,6 +356,8 @@
         __time = _time
         __time && Time.from_apr_time(__time)
       end
+
+ alias have_props? has_props
     end
 
     Config = SWIG::TYPE_p_svn_config_t

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jun 25 13:56:05 2006

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.