sup-heliotrope / ncursesw-ruby

Ruby bindings to the ncursesw library (modified from: http://ncurses-ruby.berlios.de/)
GNU Lesser General Public License v2.1
22 stars 13 forks source link

example did not work on ruby2.0 #19

Closed sevk closed 10 years ago

sevk commented 10 years ago

ncursesw-ruby/tree/master/examples

examples did not work on ruby2.0

gauteh commented 10 years ago

None of them? Which? What is the error output?

sevk commented 10 years ago

└─> ruby form_get_wch.rb

when input some something : form_get_wch.rb:76:in <main>': undefined methodform_driver_w' for Ncurses::Form:Module (NoMethodError)

└─> ruby rain.rb

press 'q' can't quit . I think it is because 'a'[0] == 'a' in ruby2.0 .

└─> ruby tclock.rb

tclock.rb:51:in `mvaddch': no implicit conversion of String into Integer (TypeError) also , 'a'[0] == 'a' in ruby2.0 .

└─> ruby read_line.rb

read_line.rb:36:in `block in read_line': bad value for range (ArgumentError)

gauteh commented 10 years ago

Please try out #20. The reason form_driver_w doesn't work is because you need a development version of ncurses with the new form_driver_w routine defined.

This fix possibly breaks, the deprecated, ruby 1.8 support.

sevk commented 10 years ago
if RUBY_VERSION < '1.9'
 class Fixnum
   def ord
     self
   end
 end
end

for both 1.8 1.9 2.0 all work ok , use this ?

gauteh commented 10 years ago

If it already works with 1.9 and 2.0 I think that is ok. There is no reason to clutter the examples to make 1.8 work.

gauteh commented 10 years ago

Fixed in #20.