Irb question

Hi,
Iam starting to learn ruby, today is my first day actually working with
terminal and things are going pretty good. I just have a quick question,
when I go into irb the book I am reading ("Ruby novice to professional"
from apress ) tells me that there should be irb(main):001:0> each line,
but for me all I have is >>
all the ruby commands work fine. I just don't like not having the line
numbers. This is probably very simple but please help a newbie out.
Thanks for your time.

···

--
Posted via http://www.ruby-forum.com/.

Looks like something has set IRB to show the simple prompt instead of
the default one. Do you have a ~/.irbrc file and if so, could you show
the contents?
For the meantime, try starting irb like this:

irb --prompt-mode default

This should show the normal prompt.

Vale,
Marvin

···

Am 09.10.2010 14:46, schrieb Darren Nickerson:

Hi,
Iam starting to learn ruby, today is my first day actually working with
terminal and things are going pretty good. I just have a quick question,
when I go into irb the book I am reading ("Ruby novice to professional"
from apress ) tells me that there should be irb(main):001:0> each line,
but for me all I have is >>
all the ruby commands work fine. I just don't like not having the line
numbers. This is probably very simple but please help a newbie out.
Thanks for your time.

Darren Nickerson wrote:

Hi,
Iam starting to learn ruby, today is my first day actually working with
terminal and things are going pretty good. I just have a quick question,
when I go into irb the book I am reading ("Ruby novice to professional"
from apress ) tells me that there should be irb(main):001:0> each line,
but for me all I have is >>
all the ruby commands work fine. I just don't like not having the line
numbers. This is probably very simple but please help a newbie out.
Thanks for your time.

I looked into it and I can only guess since you did not state it. But >>
seems to be the mac irb style, => for linux and irb(main):001:0> style
for windows. So if you want to have the numbers I suggest you invest
into an ide or text editor. There are many choices some of the free
options are netbeans for an ide and notepad++ for text editor. Those
both come with the option to have numbered lines.

If you like it in the irb you will have to run a windows machine it
seems.

Hope this helps

···

--
Posted via http://www.ruby-forum.com/\.

Darren Nickerson wrote:

Hi,
Iam starting to learn ruby, today is my first day actually working with
terminal and things are going pretty good. I just have a quick question,
when I go into irb the book I am reading ("Ruby novice to professional"
from apress ) tells me that there should be irb(main):001:0> each line,
but for me all I have is >>
all the ruby commands work fine. I just don't like not having the line
numbers. This is probably very simple but please help a newbie out.
Thanks for your time.

Try starting irb like this:

irb --prompt-mode default

Marvin

···

--
Posted via http://www.ruby-forum.com/\.

I looked into it and I can only guess since you did not state it. But >>
seems to be the mac irb style, => for linux and irb(main):001:0> style
for windows. So if you want to have the numbers I suggest you invest
into an ide or text editor. There are many choices some of the free
options are netbeans for an ide and notepad++ for text editor. Those
both come with the option to have numbered lines.

If you like it in the irb you will have to run a windows machine it seems.

Thanks, that was good for a laugh :slight_smile:

On Mac OS X -- ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

ripple:~$ irb --prompt default

ripple:~$ irb --prompt inf-ruby
irb(main):001:0>

···

On Sat, Oct 9, 2010 at 2:54 PM, Ruby Program <program.ruby@gmail.com> wrote:

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

On my Ubuntu system, the prompt has the desired style with line numbers:

$ irb
irb(main):001:0>

This is simply a difference in the default prompt as defined by the
version of irb, the system defaults for irb, and/or the user overrides
for irb. The irb prompt is actually equally configurable on any
platform from what I've seen. :slight_smile:

http://ruby-doc.org/docs/ProgrammingRuby/html/irb.html

Search for "Configuring the Prompt". I'm sure there are other sources
for information as well.

-Jeremy

···

On 10/09/2010 04:54 PM, Ruby Program wrote:

Darren Nickerson wrote:

Hi,
Iam starting to learn ruby, today is my first day actually working with
terminal and things are going pretty good. I just have a quick question,
when I go into irb the book I am reading ("Ruby novice to professional"
from apress ) tells me that there should be irb(main):001:0> each line,
but for me all I have is >>
all the ruby commands work fine. I just don't like not having the line
numbers. This is probably very simple but please help a newbie out.
Thanks for your time.

I looked into it and I can only guess since you did not state it. But >>
seems to be the mac irb style, => for linux and irb(main):001:0> style
for windows. So if you want to have the numbers I suggest you invest
into an ide or text editor. There are many choices some of the free
options are netbeans for an ide and notepad++ for text editor. Those
both come with the option to have numbered lines.

If you like it in the irb you will have to run a windows machine it
seems.

The command irb --prompt inf-ruby worked to get it looking like the way
I want it to. thanks guys

···

--
Posted via http://www.ruby-forum.com/.

Thanks guys for the information. I Guess its not a big deal, I was just
confused why my terminal looked different than the one in the book. It
seems like you don't have to use the terminal all the time. I can't wait
to know more about ruby for sure

···

--
Posted via http://www.ruby-forum.com/.

Thanks for this.

I wondered about RVM's prompt. I noticed it auto-indenting when
starting a block/class/def etc,

RVM sets the prompt:
:RVM=>
  {:PROMPT_I=>"ruby-1.9.2-p0 > ",
   :PROMPT_S=>"ruby-1.9.2-p0%l> ",
   :PROMPT_C=>"ruby-1.9.2-p0 > ",
   :PROMPT_N=>"ruby-1.9.2-p0 ?> ",
   :RETURN=>" => %s \n",
   :AUTO_INDENT=>true}}

So the AUTO_INDENT flag is true. Nice! Also, it shows the current rubie.

Cheers,
Ed

Ed Howland

http://twitter.com/ed_howland

···

On Sat, Oct 9, 2010 at 8:25 PM, Darren Nickerson <darren@thereef.ca> wrote:

The command irb --prompt inf-ruby worked to get it looking like the way
I want it to. thanks guys
--
Posted via http://www.ruby-forum.com/\.