Where can I find documentation for standard library modules
that are binaries rather than Ruby code? For example,
Ruby comes with readline support, but as far as I can tell
no documentation. And since it’s a .so I can’t easily just look
at the source (although I can always unpack the Ruby source distribution
and dig that way). I didn’t see anything about it in my copy of the Pickaxe,
either.
Anyway, my specific question is this: how do I configure the readline history?
If I just do this:
I have full editing capability on the input line, but no history;
on the second one, I can’t move up to the value I entered the
first time. But the same code executed in irb gives me access to
the history (shared with the lines entered into irb itself).
Where can I find documentation for standard library modules
that are binaries rather than Ruby code? For example,
Ruby comes with readline support, but as far as I can tell
no documentation. And since it’s a .so I can’t easily just look
at the source (although I can always unpack the Ruby source distribution
and dig that way). I didn’t see anything about it in my copy of the Pickaxe,
either.
Anyway, my specific question is this: how do I configure the readline history?
If I just do this:
I have full editing capability on the input line, but no history;
on the second one, I can’t move up to the value I entered the
first time. But the same code executed in irb gives me access to
the history (shared with the lines entered into irb itself).
-Mark
If you’re feeling brave you could read the ./ext/readline/readline.c
file under the ruby source tree.
I often have to look in .c files to see what methods I have available to
me.
Ruby distribution has directory “ext” that contains varios extention
modules, like readline, etc, curses and others. In a corresponding directory
there usually is README (or something similar) file that describes the
module.
Gennady.
···
----- Original Message -----
From: “Mark J. Reed” markjreed@mail.com
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Tuesday, August 26, 2003 10:48 AM
Subject: Readline history, and general binary module doc
Where can I find documentation for standard library modules
that are binaries rather than Ruby code? For example,
Ruby comes with readline support, but as far as I can tell
no documentation. And since it’s a .so I can’t easily just look
at the source (although I can always unpack the Ruby source distribution
and dig that way). I didn’t see anything about it in my copy of the
Pickaxe,
either.
Anyway, my specific question is this: how do I configure the readline
history?
If I just do this:
I have full editing capability on the input line, but no history;
on the second one, I can’t move up to the value I entered the
first time. But the same code executed in irb gives me access to
the history (shared with the lines entered into irb itself).
No you don’t Run irb and enter “Readline.instance_methods”!
–Gavin
···
On Wednesday, August 27, 2003, 4:00:11 AM, mgarriss wrote:
If you’re feeling brave you could read the ./ext/readline/readline.c
file under the ruby source tree.
I often have to look in .c files to see what methods I have available to
me.
I do inspect objects and modules frequently to find out what
methods are there, but sometimes just the names are not very informative.
The README in the source tree was actually very helpful; it seems
like it should get put somewhere accessible as part of the
installation of Ruby. I don’t mind plaintext doc, I just need to
be able to find it.
Oh, and the solution to my particular problem was simply to pass the
right arguments to the readline method. It has two parameters,
the first being a prompt string and the second being a flag
that, if true, causes the read line to be stored in the history.
So Readline.readline(‘’, true) was what I needed.
Thanks for all the help.
-Mark
···
On Wed, Aug 27, 2003 at 07:52:27AM +0900, Gavin Sinclair wrote:
On Wednesday, August 27, 2003, 4:00:11 AM, mgarriss wrote:
If you’re feeling brave you could read the ./ext/readline/readline.c
file under the ruby source tree.
I often have to look in .c files to see what methods I have available to
me.
No you don’t Run irb and enter “Readline.instance_methods”!
On Wednesday, August 27, 2003, 4:00:11 AM, mgarriss wrote:
If you’re feeling brave you could read the ./ext/readline/readline.c
file under the ruby source tree.
I often have to look in .c files to see what methods I have available to
me.
No you don’t Run irb and enter “Readline.instance_methods”!