In vanilla processing keyPressed is both a variable and a method, for jruby_art the boolean variable is available as key_pressed?, whereas you can create events/operations that occur on key pressed by adding a key_pressed method as below:-

def key_pressed  
  # code gets executed on key pressed you can access the `key` variable in this loop
  case key
  when 'c', 'C'
  # do stuff when c is pressed
end

For sketch with key_pressed method see raining, follow link for a sketch using key_pressed?.

See also:-

key_released