问题
I am interested in creating a command line application with ruby that would require moderately complex interaction with the user. I would like to use ncurses for this.
What is the best gem for working with ruby and ncurses, or should I be using stdlib utilities in ruby?
回答1:
Ruby includes bindings for the curses
library. Despite what the name implies, it will use ncurses if possible.
Third party libraries often provide abstractions on top of either Ruby's curses
or their own bindings. For example, ncursesw
also wraps the panel
, menu
and form
extensions. When I worked with Ruby's curses
, I created my own Window
class with proper border support.
If the basic methods are sufficient, I don't see any reason to add a dependency to your project. However, if you want to do fancy things more easily, you should use a library that provides support for what you need.
回答2:
I have found ncursesw on this Rubygems seach. Seems to be a good gem to start with.
回答3:
This one appears to have the best readme https://github.com/seanohalpin/ffi-ncurses
来源:https://stackoverflow.com/questions/9398076/best-gem-for-working-with-ncurses-and-ruby