<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -64,18 +64,16 @@ class CharactersStrings &lt; Processing::App
   def key_pressed
   	# The variable &quot;key&quot; always contains the value of the most recent key pressed.
 	  # If the key is an upper or lowercase letter between 'A' and 'z'
-	  # the image is shifted to the corresponding value of that key
-	  
-	  if (key &gt;= &quot;A&quot;[0]) and (key &lt;= &quot;z&quot;[0])  # should become &quot;A&quot;.ord and &quot;z&quot;.ord in Ruby 1.9
-		
+	  # the image is shifted to the corresponding value of that key	  
+	  if ('A'..'z').include? key
+	    
 		  # Map the index of the key pressed from the range between 'A' and 'z',
 		  # into a position for the left edge of the image. The maximum xoffset
 		  # is the width of the drawing area minus the size of the image.
-		  
-		  @xoffset = map( key, &quot;A&quot;[0], &quot;z&quot;[0], 0, width - @frog.width ).to_i
+		  @xoffset = map( key[0], &quot;A&quot;[0], &quot;z&quot;[0], 0, width - @frog.width ).to_i
 		  
 		  # Update the letter shown to the screen
-		  @letter = key.chr
+		  @letter = key
 		  
 		  # Write the letter to the console
 		  puts key</diff>
      <filename>samples/processing_app/basics/data/characters_strings/characters_strings.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,17 +17,11 @@ class Keyboard &lt; Processing::App
   end
   
   def draw
-  	if key_pressed?
-  		if key &gt;= (&quot;A&quot;[0]) &amp;&amp; key &lt;= (&quot;z&quot;[0])
-  			if key &lt;= (&quot;Z&quot;[0])
-  				@key_index = key - (&quot;A&quot;[0])
-  			else
-  				@key_index = key - (&quot;a&quot;[0])
-  			end
+  	if key_pressed? &amp;&amp; ('A'..'z').include?(key)
+  	  @key_index = key.ord - (key &lt;= 'Z' ? 'A'.ord : 'a'.ord)
 			fill millis % 255
 			begin_rect = @rect_width/2 + @key_index * @key_scale - @rect_width/2
 			rect begin_rect, 0, @rect_width, height
-  		end
   	end
   end
   </diff>
      <filename>samples/processing_app/basics/input/keyboard.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,11 +17,11 @@ class Keyboard2 &lt; Processing::App
   
   def draw
   	if key_pressed?
-  		if key.chr &amp;&amp; key.chr &gt;= &quot;A&quot; &amp;&amp; key.chr &lt;= &quot;z&quot;  # added testing 'gainst Nil
-  			if key.chr &lt;= &quot;Z&quot;
-  				@key_index = key - &quot;A&quot;.ord
+  		if ('A'..'z').include? key
+  			if key &lt;= &quot;Z&quot;
+  				@key_index = key.ord - &quot;A&quot;.ord
   			else
-  				@key_index = key - &quot;a&quot;.ord
+  				@key_index = key.ord - &quot;a&quot;.ord
   			end
 			fill millis % 255
 			begin_rect = @rect_width/2 + @key_index * @key_scale - @rect_width/2</diff>
      <filename>samples/processing_app/basics/input/keyboard_2.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,14 +28,14 @@ class KeyboardFunctions &lt; Processing::App
   def draw
   	if new_letter?
   		if upcase?
-  			fill (key - &quot;A&quot;.ord).abs % 255
+  			fill (key.ord - &quot;A&quot;.ord).abs % 255
   			rect @x, @y, @letter_width, @letter_height*2
   		else
   			# clear with letter space with background color
   			fill @num_chars/2
   			rect @x, @y, 			    @letter_width, @letter_height
   			
-  			fill (key - &quot;a&quot;.ord).abs % 255
+  			fill (key.ord - &quot;a&quot;.ord).abs % 255
   			rect @x, @y+@letter_height, @letter_width, @letter_height
   		end
   		@new_letter = false
@@ -51,26 +51,17 @@ class KeyboardFunctions &lt; Processing::App
   end
   
   def key_pressed
-  	# Try to get a String for int value in &quot;key&quot;
-  	key_char = nil
-  	key_char = key.chr rescue nil
-  	
-  	# if the key is between 'A'(65) and 'z'(122)
-  	if key_char &amp;&amp; key_char &gt;= &quot;A&quot; &amp;&amp; key_char &lt;= &quot;z&quot;
-  		if key_char &lt;= &quot;Z&quot;
-  			@upcase = true
-  		else
-  			@upcase = false
-  		end
+  	if ('A'..'z').include? key
+  		@upcase = key &lt;= &quot;Z&quot;
+  		@new_letter = true
+  		
+  		# Update the &quot;letter&quot; position and 
+    	# wrap horizontally and vertically
+    	@y += (@letter_height*2) if @x + @letter_width &gt;= width
+    	@y = @y % height
+    	@x += @letter_width
+    	@x = @x % width
   	end
-  	@new_letter = true
-  	
-  	# Update the &quot;letter&quot; position and 
-  	# wrap horizontally and vertically
-  	@y += (@letter_height*2) if @x + @letter_width &gt;= width
-  	@y = @y % height
-  	@x += @letter_width
-  	@x = @x % width
   end
   
 end</diff>
      <filename>samples/processing_app/basics/input/keyboard_functions.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>db4a7ea6dabf20b1327a61d49a0cb1a2d86d9595</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Ashkenas</name>
    <email>jashkenas@gmail.com</email>
  </author>
  <url>http://github.com/jashkenas/ruby-processing/commit/e8f2b576380ffa682f82d856980be9c6f29b3d1f</url>
  <id>e8f2b576380ffa682f82d856980be9c6f29b3d1f</id>
  <committed-date>2009-10-06T07:05:55-07:00</committed-date>
  <authored-date>2009-10-06T07:05:55-07:00</authored-date>
  <message>fixing broken samples that were expecting key() to return an integer instead of a character</message>
  <tree>a01a3440841b2d30d9eb0356d3b44e72e929daa1</tree>
  <committer>
    <name>Jeremy Ashkenas</name>
    <email>jashkenas@gmail.com</email>
  </committer>
</commit>
