You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2018/09/27 15:53:33 UTC

svn commit: r1842107 - /subversion/trunk/subversion/bindings/swig/ruby/svn/util.rb

Author: julianfoad
Date: Thu Sep 27 15:53:33 2018
New Revision: 1842107

URL: http://svn.apache.org/viewvc?rev=1842107&view=rev
Log:
Teach the Ruby bindings to handle experimental class names like
svn_client__shelf_t.

* subversion/bindings/swig/ruby/svn/util.rb
  (to_ruby_class_name): Don't choke on a name like '_shelf': return 'XShelf'.

Modified:
    subversion/trunk/subversion/bindings/swig/ruby/svn/util.rb

Modified: subversion/trunk/subversion/bindings/swig/ruby/svn/util.rb
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/ruby/svn/util.rb?rev=1842107&r1=1842106&r2=1842107&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/ruby/svn/util.rb (original)
+++ subversion/trunk/subversion/bindings/swig/ruby/svn/util.rb Thu Sep 27 15:53:33 2018
@@ -36,8 +36,13 @@ module Svn
   module Util #:nodoc:
     module_function
     def to_ruby_class_name(name)
+      # Convert to CamelCase with 'X' for a leading/double/trailing underscore.
       name.to_s.split("_").collect do |x|
-        "#{x[0,1].upcase}#{x[1..-1].downcase}"
+        if x.empty?
+          "X"
+        else
+          x.capitalize
+        end
       end.join("")
     end