Help..Newbe to Ruby

Greetings

I am a new bee to Ruby. I am practicing Ruby using “Learn Ruby the hard
way”

I am using Windows 7 and used Ruby Installer for Windows

I am using the prompt - Start command prompt with Ruby - to execute my
.rb files

Now when trying to type in —> require ‘./ex25’ – it gives an error
stating:-

require is not recognized as internal or external command, operable
program or batch file.

I searched the forum, but couldn’t exactly resolve the issue.

Appreciate if anyone can help me on this, so i can resolve and continue
with other exercises. Stuck on this :frowning:

Thanks
Shaji

On Tue, Feb 26, 2013 at 10:21 AM, shaji n. [email protected] wrote:

Now when trying to type in —> require ‘./ex25’ – it gives an error
stating:-

require is not recognized as internal or external command, operable
program or batch file.

You are trying Ruby commands at the windows prompt. You want to run
the interactive REPL, type irb and then you can run ruby code
interactively.

Jesus.

Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\XYZ>cd…

C:\Documents and Settings>cd…

C:>irb --simple-prompt (you can also type only “irb”)

require “selenium-webdriver”
=> true

Try the above.

Hope it will help. :slight_smile:

Love U Ruby wrote in post #1099112:

C:\Documents and Settings\XYZ>cd…

C:\Documents and Settings>cd…

This is the same as typing cd/

C:>irb --simple-prompt (you can also type only “irb”)

you can type irb from anywhere if it’s in your PATH

Joel P. wrote in post #1099121:

Love U Ruby wrote in post #1099112:

C:\Documents and Settings\XYZ>cd…

C:\Documents and Settings>cd…

This is the same as typing cd/

C:>irb --simple-prompt (you can also type only “irb”)

you can type irb from anywhere if it’s in your PATH

Yeah! you are right. I used this practice thus shown him that way.

:slight_smile:

Am 26.02.2013 13:27, schrieb Love U Ruby:

BTW: --simple-prompt is bad for email, because email clients
display ‘>>’ as a “quoted quote” (in my case two differently colored
vertical lines), which makes your code examples look strange and
difficult to read.

THANK YOU

I was able to decode and resolve it with all your help

Thanks Again for the great responses. Appreciate all your help

Thanks again

Kumar R. wrote in post #1100051:

I generally used the below one in my console :

C:>irb --simple-prompt

“abc”.next
=> “abd”

“abc”.next.next
=> “abe”

Can I get the prompt with line numbers as below in console ?

C:>irb --simple-prompt
1>> “abc”.next
2=> “abd”
3>> “abc”.next.next
4=> “abe”
5>>

You can always check the help…

~ irb --help
Usage: irb.rb [options] [programfile] [arguments]
-f ~/.irbrc を読み込まない.
-m bcモード(分数, 行列の計算ができる)
-d $DEBUG をtrueにする(ruby -d と同じ)
-r load-module ruby -r と同じ.
-I path $LOAD_PATH に path を追加する.
-U ruby -U と同じ.
-E enc ruby -E と同じ.
-w ruby -w と同じ.
-W[level=2] ruby -W と同じ.
–inspect 結果出力にinspectを用いる(bcモード以外はデフォルト).
–noinspect 結果出力にinspectを用いない.
–readline readlineライブラリを利用する.
–noreadline readlineライブラリを利用しない.
–prompt prompt-mode/–prompt-mode prompt-mode
プロンプトモードを切替えます. 現在定義されているプ
ロンプトモードは, default, simple, xmp, inf-rubyが
用意されています.
–inf-ruby-mode emacsのinf-ruby-mode用のプロンプト表示を行なう. 特
に指定がない限り, readlineライブラリは使わなくなる.
–simple-prompt 非常にシンプルなプロンプトを用いるモードです.
–noprompt プロンプト表示を行なわない.
–tracer コマンド実行時にトレースを行なう.
–back-trace-limit n
バックトレース表示をバックトレースの頭から n, 後ろ
からnだけ行なう. デフォルトは16
–irb_debug n irbのデバッグデバッグレベルをnに設定する(利用しな
い方が無難でしょう).
-v, --version irbのバージョンを表示する

If you don’t see it there, ruby is open source, and you can fix it
yourself.

I generally used the below one in my console :

C:>irb --simple-prompt

“abc”.next
=> “abd”

“abc”.next.next
=> “abe”

Can I get the prompt with line numbers as below in console ?

C:>irb --simple-prompt
1>> “abc”.next
2=> “abd”
3>> “abc”.next.next
4=> “abe”
5>>

The below one I found useful:

C:>irb
irb(main):001:0> conf.prompt_i = “%n $”
=> “%n $”
2 $p “hi”
“hi”
=> “hi”
3 $x = 2 + 5
=> 7
4 $

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs