# sign does not work as expected form irb

S

Salvador Sanjuan

I have just started Ruby. I have tried to do some exercises usin irb but
this is what happens if I write the following code msg = "Hello "
#{name} ":


irb<main>:157:0> #msg "Hello,
irb<main>:158:0>*

As as soon as I enter the # sign after the Hello it moves to the
beggining of the line and a new line appears.

My computer works with Windows XP.

How can I change the way the # sign works+
 
A

Aldric Giacomoni

Salvador said:
I have just started Ruby. I have tried to do some exercises usin irb but
this is what happens if I write the following code msg = "Hello "
#{name} ":

Please try this :
msg = "Hello #{name} ".
 
S

Salvador Sanjuan

Aldric said:
Please try this :
msg = "Hello #{name} ".

Sorry in my initial post I've made I mistake.

I already wrote the code as you are proposing me. The problem is that
the # sign goes to the start of the line as soon as I type it, and opens
an new line.

It must be something to do with the irb and my keyboard configuration
but I've just started with ruby and have no idea.

Thank you very much.
 
A

Aldric Giacomoni

I've never heard of or seen this behavior.
What keyboard are you using? In what language is Windows XP? What key
combination do you use to get # (for me, it's Shift-3)? What tool do you
use for irb? is it cmd.exe ?
 
R

Robert Klemme

2009/8/27 Salvador Sanjuan said:
Sorry in my initial post I've made I mistake.

I already wrote the code as you are proposing me. The problem is that
the # sign goes to the start of the line as soon as I type it, and opens
an new line.

It must be something to do with the irb =A0and my keyboard configuration
but I've just started with ruby and have no idea.

Maybe it's not IRB but your terminal.

Cheers

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 
S

Salvador Sanjuan

Aldric said:
I've never heard of or seen this behavior.
What keyboard are you using? In what language is Windows XP? What key
combination do you use to get # (for me, it's Shift-3)? What tool do you
use for irb? is it cmd.exe ?

The keyboard is forma IBM. The language is Spanish international. To get
# I use AltGr+3

The tool I use is irb.
 
A

Aldric Giacomoni

Salvador said:
The keyboard is forma IBM. The language is Spanish international. To get
# I use AltGr+3

The tool I use is irb.

Where does IRB run? In a command-line window? A special program? (I use
a tool called 'console2' which I got from sourceforge).

If you type the # in a regular terminal / command-line window, does it
go to the next line? I suspect that AltGr is the problem, but I am not
sure.
 
S

Salvador Sanjuan

Aldric said:
Where does IRB run? In a command-line window? A special program? (I use
a tool called 'console2' which I got from sourceforge).

If you type the # in a regular terminal / command-line window, does it
go to the next line? I suspect that AltGr is the problem, but I am not
sure.

The IRB runs on command-line window. But it does just the same with fxri
for example.

If I type # the character moves to the beggining of the line and opens a
new line.
 
R

Robert Klemme

2009/8/27 Salvador Sanjuan said:
The IRB runs on command-line window. But it does just the same with fxri
for example.

If I type # the character moves to the beggining of the line and opens a
new line.

I have no idea how you would provoke that effect in a Windows XP
command window. I can type as many # as I want, the cursor does not
jump. Maybe reboot? ;-)

robert
 
S

Salvador Sanjuan

Robert said:
I have no idea how you would provoke that effect in a Windows XP
command window. I can type as many # as I want, the cursor does not
jump. Maybe reboot? ;-)

robert

It doesn't work either. Thanks for your time
 
A

Aldric Giacomoni

What about other special characters like AltGr 6, AltrGr 7, etc? What do
those do?
 
S

Salvador Sanjuan

Aldric said:
What about other special characters like AltGr 6, AltrGr 7, etc? What do
those do?
I only have \(AltGr + º), |(AltGr +1)and @(AltGr +2). They work well.
 
H

Heesob Park

Hi,

2009/8/27 Salvador Sanjuan said:
I have just started Ruby. I have tried to do some exercises usin irb but
this is what happens if I write the following code msg = "Hello "
#{name} ":


irb<main>:157:0> #msg "Hello,
irb<main>:158:0>*

As as soon as I enter the # sign after the Hello it moves to the
beggining of the line and a new line appears.

My computer works with Windows XP.

How can I change the way the # sign works+

I guess your ruby is 1.8.6 OCI version.
This problem is due to the bug of readline.dll(Readline-4.3-2).
The behavior is "rl_insert_comment".

Try following:
1. Create a file named "inpurc" in your ruby binary directory with the content
"\M-#": "#"

2. Create an environment variable in the System Properties->Advanced
Tab->Environment Variables area called INPUTRC and set it to
c:\ruby\bin\inputrc

Regards,

Park Heesob
 
S

Salvador Sanjuan

Heesob said:
Hi,



I guess your ruby is 1.8.6 OCI version.
This problem is due to the bug of readline.dll(Readline-4.3-2).
The behavior is "rl_insert_comment".

Try following:
1. Create a file named "inpurc" in your ruby binary directory with the
content
"\M-#": "#"

2. Create an environment variable in the System Properties->Advanced
Tab->Environment Variables area called INPUTRC and set it to
c:\ruby\bin\inputrc

Regards,

Park Heesob

Hi Park I tried what you told me and it worked. I had to add the text on
a file named inputrc.euro that is in the same directory so other keys
will work as well.

Thank you very much.

Salvador Sanjuan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top