Hello All,
I have been playing around with Ruby now for about a few weeks now and I was wondering how hard
it would be to write a simple text editor in Ruby to be run in terminal; not having any GUI components
but maybe after it was build as an update to the program.
I think it would be fun to write a Ruby program within a Ruby.
**Happy Coding**
question: Ruby Text Editer
Page 1 of 111 Replies - 2574 Views - Last Post: 23 May 2012 - 04:45 PM
Replies To: question: Ruby Text Editer
#2
Re: question: Ruby Text Editer
Posted 22 May 2012 - 06:48 PM
Hello! Awesome to hear you're experimenting with ruby!
You could utilize rbcurse which is described as "a comprehensive widget library written in ruby for creating ncurses applications."
If you don't know anything about ncurses it is described as "a programming library that provides an API which allows the programmer to write text-based user interfaces in a terminal-independent manner."
This would be a good place to start learning about how to create terminal-based user interfaces.
Hope that helps!
You could utilize rbcurse which is described as "a comprehensive widget library written in ruby for creating ncurses applications."
If you don't know anything about ncurses it is described as "a programming library that provides an API which allows the programmer to write text-based user interfaces in a terminal-independent manner."
This would be a good place to start learning about how to create terminal-based user interfaces.
Hope that helps!
#3
Re: question: Ruby Text Editer
Posted 22 May 2012 - 06:57 PM
I'm not sure that writing a terminal text-editor (unless it's a simple command-based one) would actually be easier than writing a GUI text-editor. ncurses isn't really easier to work with than most GUI libraries.
#4
Re: question: Ruby Text Editer
Posted 22 May 2012 - 07:06 PM
A text editer like nano is what i mean.
Also, is there a site what would show me how to code one
with out the heavy use of GEMS or library.. Coding the
whole thing from the ground up?
Also, is there a site what would show me how to code one
with out the heavy use of GEMS or library.. Coding the
whole thing from the ground up?
#5
Re: question: Ruby Text Editer
Posted 22 May 2012 - 07:12 PM
For the most part, if you have to ask how, it's time to either break out the paper and start thinking, or find another project.
Depending on your skill level currently, this could either be a valid exercise, or something completely overkill. What you CAN do is look at the source code of say nano, vim, or emacs. It's written primarily in C, so translation won't be horrid and it's not a far transfer for most things.
Depending on your skill level currently, this could either be a valid exercise, or something completely overkill. What you CAN do is look at the source code of say nano, vim, or emacs. It's written primarily in C, so translation won't be horrid and it's not a far transfer for most things.
#6
Re: question: Ruby Text Editer
Posted 22 May 2012 - 07:15 PM
How would I find the source code of such an application??
#7
Re: question: Ruby Text Editer
Posted 22 May 2012 - 07:24 PM
smoothedatol412, on 23 May 2012 - 04:06 AM, said:
A text editer like nano is what i mean.
So not command-based. Then what I said stands and you could just as well write a GUI text editor.
Quote
Also, is there a site what would show me how to code one
with out the heavy use of GEMS or library.. Coding the
whole thing from the ground up?
with out the heavy use of GEMS or library.. Coding the
whole thing from the ground up?
Not using gems would mean you have to write your own C extension to use the (n)curses library1. Not using (n)curses would mean, you'll have to write your own C library to replace ncurses (in platform specific C code). Not using any libraries (including the ones provided by the OS) would mean you can't. The functionality you need just isn't available in plain ruby1 (or standard C for that matter).
1 Actually ruby includes curses binding in the standard library, so you could use those if you don't count that as cheating.
This post has been edited by sepp2k: 22 May 2012 - 07:28 PM
#10
Re: question: Ruby Text Editer
Posted 22 May 2012 - 07:43 PM
Quote
Yes. Did I say something that makes you think that would not be the case?
When you said, "So not command-based," I thought you were advising against it. Everything is clear now.
#11
Re: question: Ruby Text Editer
Posted 22 May 2012 - 07:45 PM
I just meant that if it had been command-based, you could implement that just by using gets and puts. But if you want to implement a visual text editor like nano, you need something like ncurses/rbcurses or a GUI library.
#12
Re: question: Ruby Text Editer
Posted 23 May 2012 - 04:45 PM
Thank you all for the replies I have a lot of reading and code testing
thanks to all of your wonderful ideas. I will be sure to do a blog entry
about my results with the application in ruby.
thanks to all of your wonderful ideas. I will be sure to do a blog entry
about my results with the application in ruby.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote






|