Ljust and rjust broken on OSX


#1

ruby 1.8.2 (2004-11-03) [powerpc-darwin7.5.0]
tripus% irb
irb(main):001:0> “test”.rjust(5,“x”)
=> " test"
irb(main):002:0> “test”.ljust(5, “x”)
=> "test "


#2

On Nov 29, 2005, at 2:22 PM, kleinman wrote:

ruby 1.8.2 (2004-11-03) [powerpc-darwin7.5.0]
^^^^^^^^^^

That’s not 1.8.2, 1.8.2 was released 2004-12-25

tripus% irb
irb(main):001:0> “test”.rjust(5,“x”)
=> " test"
irb(main):002:0> “test”.ljust(5, “x”)
=> "test "

$ ruby182-orig -v
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
$ ruby182-orig -e ‘p “test”.rjust(5, “x”)’
“xtest”
$ ruby182-orig -e ‘p “test”.ljust(5, “x”)’
“testx”
$ ruby183 -v
ruby 1.8.3 (2005-09-21) [powerpc-darwin8.2.0]
$ ruby183 -e ‘p “test”.ljust(5, “x”)’
“testx”
$ ruby183 -e ‘p “test”.rjust(5, “x”)’
“xtest”


Eric H. - removed_email_address@domain.invalid - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com


#3

Thanks Eric. Your reply prompted me to see how many ruby were installed
on my PB.

Seems I had 2:
/local/bin/ruby
/bin/ruby

tripus% ./bin/ruby -v
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
tripus% ./bin/ruby -e ‘p “test”.rjust(5,“x”)’
“xtest”

tripus% ./local/bin/ruby -v
ruby 1.8.2 (2004-11-03) [powerpc-darwin7.5.0]
tripus% ./local/bin/ruby -e ‘p “test”.rjust(5,“x”)’
" test"

No idea where the second one is coming from.
Thanks for the feedback - Martin


#4

On Nov 29, 2005, at 14:31, Eric H. wrote:

On Nov 29, 2005, at 2:22 PM, kleinman wrote:

ruby 1.8.2 (2004-11-03) [powerpc-darwin7.5.0]
^^^^^^^^^^

That’s not 1.8.2, 1.8.2 was released 2004-12-25

It is 1.8.2. It’s a pre-release. I spent a lot of time trying to figure
out why things didn’t work the way they were supposed to until I found
out I had “the other 1.8.2”, and I needed to upgrade my install of
1.8.2 to 1.8.2.

Mutter mutter fume.