[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: new to this language

Ghelani, Vidhi

2/11/2005 8:01:00 PM



Hey Forrest,

How do I write it in an editor using the irb shell? I don't know but for
some reason I cant do much with this shell? I tried typing emacs test.rb
but it tries to run that like a file. DO I need to use some other shell
for using my editors?

Thanks,
Vidhi



-----Original Message-----
From: Forrest Chang [mailto:fkchang2000@yahoo.com]
Sent: Friday, February 11, 2005 11:24 AM
To: ruby-talk ML
Subject: Re: new to this language

you could cheat a little and write it in your editor
(many of them support a ruby mode with syntax
highlighting and other stuff), and the type "load
'module'" in irb to load it. Since you will likley
be changing it regularly you don't want to use require
which will load it only the 1st time -- load forces
load each time.

Me personally, I modified the mode-compile mode in
(x)emacs to recognize ruby, so I run from (x)emacs,
and get the cool "jump to the error in your source
code" feature that emacs compile modes have.

Forrest
--- "Ghelani, Vidhi" <vidhi.ghelani@intel.com> wrote:

> Hey Douglas,
>
> This may seem like a really silly question but I
> have irb installed and
> I was wondering how do I have to go about typing an
> entire class and
> running it from this shell?
>
> Thanks,
> Vidhi.
>
>
> -----Original Message-----
> From: Douglas Livingstone [mailto:rampant@gmail.com]
>
> Sent: Friday, February 11, 2005 10:46 AM
> To: ruby-talk ML
> Subject: Re: new to this language
>
> On Sat, 12 Feb 2005 03:07:39 +0900, Ghelani, Vidhi
> <vidhi.ghelani@intel.com> wrote:
> >
> > Hey,
> >
> > "(btw. what os are you using?)" ...I am using
> windows xp. But the way
> I am working on this is, I connect to a secure shell
> network, using
> putty, and I am connect using an IP address of a
> linux machine. Now, is
> there any way I could work on this using windows
> itself?
>
>
> Sure, just download
> http://rubyforge.org/projects/ruby... and
> then add ruby/bin to your %PATH%.
>
> Douglas
>
>
>





2 Answers

Tim Ferrell

2/11/2005 8:08:00 PM

0

It is two separate steps ... Edit with emacs and save then run irb and
load...

Cheers,
Tim

ps - welcome to ruby :-)

Ghelani, Vidhi wrote:
>
> Hey Forrest,
>
> How do I write it in an editor using the irb shell? I don't know but for
> some reason I cant do much with this shell? I tried typing emacs test.rb
> but it tries to run that like a file. DO I need to use some other shell
> for using my editors?
>
> Thanks,
> Vidhi
>
>
>
> -----Original Message-----
> From: Forrest Chang [mailto:fkchang2000@yahoo.com]
> Sent: Friday, February 11, 2005 11:24 AM
> To: ruby-talk ML
> Subject: Re: new to this language
>
> you could cheat a little and write it in your editor
> (many of them support a ruby mode with syntax
> highlighting and other stuff), and the type "load
> 'module'" in irb to load it. Since you will likley
> be changing it regularly you don't want to use require
> which will load it only the 1st time -- load forces
> load each time.
>
> Me personally, I modified the mode-compile mode in
> (x)emacs to recognize ruby, so I run from (x)emacs,
> and get the cool "jump to the error in your source
> code" feature that emacs compile modes have.
>
> Forrest
> --- "Ghelani, Vidhi" <vidhi.ghelani@intel.com> wrote:
>
>
>>Hey Douglas,
>>
>>This may seem like a really silly question but I
>>have irb installed and
>>I was wondering how do I have to go about typing an
>>entire class and
>>running it from this shell?
>>
>>Thanks,
>>Vidhi.
>>
>>
>>-----Original Message-----
>>From: Douglas Livingstone [mailto:rampant@gmail.com]
>>
>>Sent: Friday, February 11, 2005 10:46 AM
>>To: ruby-talk ML
>>Subject: Re: new to this language
>>
>>On Sat, 12 Feb 2005 03:07:39 +0900, Ghelani, Vidhi
>><vidhi.ghelani@intel.com> wrote:
>>
>>>Hey,
>>>
>>>"(btw. what os are you using?)" ...I am using
>>
>>windows xp. But the way
>>I am working on this is, I connect to a secure shell
>>network, using
>>putty, and I am connect using an IP address of a
>>linux machine. Now, is
>>there any way I could work on this using windows
>>itself?
>>
>>
>>Sure, just download
>>http://rubyforge.org/projects/ruby... and
>>then add ruby/bin to your %PATH%.
>>
>>Douglas
>>
>>
>>
>
>
>
>


Forrest Chang

2/14/2005 4:54:00 PM

0

Hi Vidhi
--- "Ghelani, Vidhi" <vidhi.ghelani@intel.com> wrote:

>
>
> Hey Forrest,
>
> How do I write it in an editor using the irb shell?
> I don't know but for
> some reason I cant do much with this shell? I tried
> typing emacs test.rb
> but it tries to run that like a file. DO I need to
> use some other shell
> for using my editors?
>

Sorry I wasn't clear on this since you may not be
very familiar with (X)emacs. Emacs is an editor, so
when you type emacs test.rb, it correctly opens the
test.rb file for editing. If emacs is setup well, it
should automatically recognize the file as a ruby file
and bring up the buffer in ruby mode, which gives you
things like syntax highlighting, automatic
indentation, access to functions, via a menu, etc...
Like ides, you can compile directly from emacs, which
in the case of dynamic languages such as perl, python,
ruby, etc... really also involves running the script
in question. The benefits of doing this within emacs
(or an ide) is the ability to easily jump to errors
within the code. This is what I do and what I was
referring to when I suggested such. That being said,
you could just type meta-x compile, change the command
line to be something like ruby -w test.rb and see the
results. There is a mode call mode-compile which
tries to smartly deduce from the filename, what kind
of compilation command to use, which supports many
languages, but unfortunately not ruby, I've since
quickly modified mine to recognize ruby by largely
duplicating the perl settings, which works mostly
well, and thus I can quickly and easily run any ruby
file I am editing, which makes for a quick and handy
development process.

YOu could run irb as an inferior process, but I
don't develop that way, perhaps someone else can help.
I would imagine that there are bindings to quickly
load files into irb to do something similar to how I
described with the mode-comple. I may investigate
this as I'm doing quite a bit of jruby work (ruby
implemented in java), and the startup times are
killing me.

Forrest


> Thanks,
> Vidhi
>
>
>
> -----Original Message-----
> From: Forrest Chang [mailto:fkchang2000@yahoo.com]
> Sent: Friday, February 11, 2005 11:24 AM
> To: ruby-talk ML
> Subject: Re: new to this language
>
> you could cheat a little and write it in your editor
> (many of them support a ruby mode with syntax
> highlighting and other stuff), and the type "load
> 'module'" in irb to load it. Since you will likley
> be changing it regularly you don't want to use
> require
> which will load it only the 1st time -- load forces
> load each time.
>
> Me personally, I modified the mode-compile mode in
> (x)emacs to recognize ruby, so I run from (x)emacs,
> and get the cool "jump to the error in your source
> code" feature that emacs compile modes have.
>
> Forrest
> --- "Ghelani, Vidhi" <vidhi.ghelani@intel.com>
> wrote:
>
> > Hey Douglas,
> >
> > This may seem like a really silly question but I
> > have irb installed and
> > I was wondering how do I have to go about typing
> an
> > entire class and
> > running it from this shell?
> >
> > Thanks,
> > Vidhi.
> >
> >
> > -----Original Message-----
> > From: Douglas Livingstone
> [mailto:rampant@gmail.com]
> >
> > Sent: Friday, February 11, 2005 10:46 AM
> > To: ruby-talk ML
> > Subject: Re: new to this language
> >
> > On Sat, 12 Feb 2005 03:07:39 +0900, Ghelani, Vidhi
> > <vidhi.ghelani@intel.com> wrote:
> > >
> > > Hey,
> > >
> > > "(btw. what os are you using?)" ...I am using
> > windows xp. But the way
> > I am working on this is, I connect to a secure
> shell
> > network, using
> > putty, and I am connect using an IP address of a
> > linux machine. Now, is
> > there any way I could work on this using windows
> > itself?
> >
> >
> > Sure, just download
> > http://rubyforge.org/projects/ruby... and
> > then add ruby/bin to your %PATH%.
> >
> > Douglas
> >
> >
> >
>
>
>
>