xkbdesc/tests/ruby find_match.rb,1.3,1.4 xkbparser.rb,1.2,1.3

"Sergey V. Oudaltsov" <xlibs-commit-u7BhqnqprCWvj1b/[email protected]>
Newsgroups gmane.comp.freedesktop.xlibs.cvs
Message-ID <[email protected]>
Committed by: svu

Update of /cvs/xlibs/xkbdesc/tests/ruby
In directory kemper:/tmp/cvs-serv17312

Modified Files:
	find_match.rb xkbparser.rb 
Log Message:
redefined keys and size in xkb_symbols

Index: find_match.rb
===================================================================
RCS file: /cvs/xlibs/xkbdesc/tests/ruby/find_match.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- find_match.rb	26 Oct 2006 22:56:06 -0000	1.3
+++ find_match.rb	26 Oct 2006 23:53:18 -0000	1.4
@@ -30,7 +30,7 @@
   end
 
   sorted.find_all do | symsName, diff |
-    puts "  #{symsName}, up to #{allSyms[symsName].rough_size} keys (difference #{diff.size})-> #{diff}"
+    puts "  #{symsName}, up to #{allSyms[symsName].size} keys (difference #{diff.size})-> #{diff}"
   end
 
 end

Index: xkbparser.rb
===================================================================
RCS file: /cvs/xlibs/xkbdesc/tests/ruby/xkbparser.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xkbparser.rb	26 Oct 2006 22:56:06 -0000	1.2
+++ xkbparser.rb	26 Oct 2006 23:53:18 -0000	1.3
@@ -37,6 +37,7 @@
   end
 
   alias get_original []
+  alias keys_original keys
 
   #
   # Get the symbol, trying first own definitions, then walking through all 
@@ -58,16 +59,23 @@
   end
 
   #
-  # Approximate size - does not take into account overlapping key definitions
+  # All keys - including the ones specified in the included sections
   #
-  def rough_size()
-    @includedSyms.inject(size) do | sum, symsName |
-        syms = @symbolsList[symsName]
-        syms.size + sum
+  def keys()
+    @includedSyms.inject(keys_original) do | rv, symsName |
+      syms = @symbolsList[symsName]
+      rv | syms.keys
     end
   end
 
   #
+  # Size - takes into account overlapping key definitions
+  #
+  def size()
+    keys.size()
+  end
+
+  #
   # Create a hash including all elements of this hash which are not in the
   # other hash, use symbols + and * for marking the elements which existed in
   # the original hash (+ if not existed)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.