[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

irb dyamic prompt configuration

Rob Coeur

2/20/2007 5:24:00 AM

Hi new to ruby here. Currently I am spending alot of time playing around
on irb.
I am able to set up the prompt to my liking with a .irbc file however, I
would like the prompt to update based upon my working directory. A *sh
style prompt like : [hostname:/home/don/scripts].

How can I do this?

thanks

rob

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

5 Answers

Marcello Barnaba

2/20/2007 6:26:00 AM

0

Hi,

On Tuesday 20 February 2007 06:23, Rob Coeur wrote:
> Hi new to ruby here. Currently I am spending alot of time playing around
> on irb.
> I am able to set up the prompt to my liking with a .irbc file however, I
> would like the prompt to update based upon my working directory. A *sh
> style prompt like : [hostname:/home/don/scripts].
>
> How can I do this?

something on the lines of

cwd = Proc.new { Dir.getwd + "| %N(%m):%03n:%i> " }
cwd.instance_eval do alias :dup :call end

IRB::conf[:PROMPT][:CWD] = {
:PROMPT_C=>nil,
:AUTO_INDENT=>true,
:RETURN=>"%s\n",
:PROMPT_I=>cwd,
:PROMPT_N=>nil,
:PROMPT_S=>nil
}
IRB::conf[:PROMPT_MODE] = :CWD

in ~/.irbrc

the key here is that irb calls .dup when building the prompt string (look
in /usr/lib/ruby/1.8/irb.rb at line 265).

HTH
--
pub 1024D/8D2787EF 723C 7CA3 3C19 2ACE 6E20 9CC1 9956 EB3C 8D27 87EF

jazzyJack

6/8/2012 12:42:00 AM

0

On Thursday, June 7, 2012 3:55:08 PM UTC-7, Ronnie Bateman wrote:
> (Steve N*wport) wrote:
>
> > I can't be the only one who thought "wow, class act" when Cooper angrily
> > confronted Don about the check and Don merely said "I'll take care of
> > it" rather than absolving himself of blame.
> > ---------------------------------------
> > SN: And look how well that turned out!
>
> Oh yes, because if he had immediately told everyone about Lane's crime,
> Lane definitely wouldn't have been fired or thought of suicide. Sheesh.

Have we ever seen anyone besides Don be a hard-ass on any moral issue? I think that if Lane could have made his case to the partners and kept his head about it (none of the whining self-justication he gave to Don), he could well have made a case for a "second chance." Lane might well have reminded them all that SCDPH owed its very existence to Lane's willingness to participate in the ethically-questionable "coup" against the Brits four years prior.

Ronnie Bateman

6/8/2012 1:09:00 AM

0

jazzyjackkirby@gmail.com wrote:

> > > I can't be the only one who thought "wow, class act" when Cooper angrily
> > > confronted Don about the check and Don merely said "I'll take care of
> > > it" rather than absolving himself of blame.
> > > ---------------------------------------
> > > SN: And look how well that turned out!
> >
> > Oh yes, because if he had immediately told everyone about Lane's crime,
> > Lane definitely wouldn't have been fired or thought of suicide. Sheesh.
>
> Have we ever seen anyone besides Don be a hard-ass on any moral issue? I
> think that if Lane could have made his case to the partners and kept his head
> about it (none of the whining self-justication he gave to Don), he could well
> have made a case for a "second chance." Lane might well have reminded them
> all that SCDPH owed its very existence to Lane's willingness to participate
> in the ethically-questionable "coup" against the Brits four years prior.

Well, Cooper's angry reaction to the check seemed pretty "hard-ass."

Adam H. Kerman

6/8/2012 1:15:00 AM

0

jazzyjackkirby@gmail.com wrote:
>On Thursday, June 7, 2012 3:55:08 PM UTC-7, Ronnie Bateman wrote:
>>(Steve N*wport) wrote:

>>>I can't be the only one who thought "wow, class act" when Cooper angrily
>>>confronted Don about the check and Don merely said "I'll take care of
>>>it" rather than absolving himself of blame.
>>>---------------------------------------
>>>SN: And look how well that turned out!

>>Oh yes, because if he had immediately told everyone about Lane's crime,
>>Lane definitely wouldn't have been fired or thought of suicide. Sheesh.

>Have we ever seen anyone besides Don be a hard-ass on any moral issue?

Lane's embezzlement wasn't a moral issue. You're raising an irrelevancy.
It's ethical because that was his role in the company, not to mention
criminal.

As far as Don being hard-assed on an actual moral issue, you'll have
to give us an example. Don objected to some of Roger's affairs, but
put it in business terms.

>I think that if Lane could have made his case to the partners and kept
>his head about it (none of the whining self-justication he gave to Don),
>he could well have made a case for a "second chance."

What would Lane's role have been at the company? As he'd embezzled,
he couldn't have been retained in his current role.

>Lane might well have reminded them all that SCDPH owed its very existence
>to Lane's willingness to participate in the ethically-questionable "coup"
>against the Brits four years prior.

Lane might have done that before he decided to forge the check. The three
men might have lent him the money.

jazzyJack

6/8/2012 3:14:00 AM

0

On Thursday, June 7, 2012 6:15:18 PM UTC-7, Adam H. Kerman wrote:
> jazzyjackkirby wrote:
> >On Thursday, June 7, 2012 3:55:08 PM UTC-7, Ronnie Bateman wrote:
> >>(Steve N*wport) wrote:
>
> >>>I can't be the only one who thought "wow, class act" when Cooper angrily
> >>>confronted Don about the check and Don merely said "I'll take care of
> >>>it" rather than absolving himself of blame.
> >>>---------------------------------------
> >>>SN: And look how well that turned out!
>
> >>Oh yes, because if he had immediately told everyone about Lane's crime,
> >>Lane definitely wouldn't have been fired or thought of suicide. Sheesh.
>
> >Have we ever seen anyone besides Don be a hard-ass on any moral issue?
>
> Lane's embezzlement wasn't a moral issue. You're raising an irrelevancy.
> It's ethical because that was his role in the company, not to mention
> criminal.

Embezzlement isn't a moral issue? That's astounding given that morals, ethics, and legality are intertwined concepts: Morality is the distinction between "right" and "wrong." Ethics is how an individual exercises morality. And legality is how a society applies ethical standards to itself.

>
> As far as Don being hard-assed on an actual moral issue, you'll have
> to give us an example. Don objected to some of Roger's affairs, but
> put it in business terms.

He didn't object to Roger's proposition to Betty on "business terms". Though Don *did* unfairly blame Betty for Roger's actions.

>
> >I think that if Lane could have made his case to the partners and kept
> >his head about it (none of the whining self-justication he gave to Don),
> >he could well have made a case for a "second chance."
>
> What would Lane's role have been at the company? As he'd embezzled,
> he couldn't have been retained in his current role.
>
> >Lane might well have reminded them all that SCDPH owed its very existence
> >to Lane's willingness to participate in the ethically-questionable "coup"
> >against the Brits four years prior.
>
> Lane might have done that before he decided to forge the check. The three
> men might have lent him the money.

Fair comments. Lane did paint himself into a corner. But Lane's actions can't be blamed on Don.