Bug in String#rjust

Hi.

I'm using one-click-installer Ruby 1.8.2 (2004-11-06) on WinXP-SP1 and
I think I have a bug in the String method #rjust

irb(main):002:0> "0".rjust( 2, "-" )
=> " 0"
irb(main):003:0> "0".rjust( 2, "-", 22 )
ArgumentError: wrong number of arguments (3 for 2)
        from (irb):3:in `rjust'
        from (irb):3
irb(main):004:0>

It's expecting 2 parameters, but ignoring the padding argument and using spaces.

Does anyone else see this?

M

···

--
Matt Mower :: http://matt.blogs.it/

Matt Mower wrote:

Hi.

I'm using one-click-installer Ruby 1.8.2 (2004-11-06) on WinXP-SP1

and

I think I have a bug in the String method #rjust

irb(main):002:0> "0".rjust( 2, "-" )
=> " 0"
irb(main):003:0> "0".rjust( 2, "-", 22 )
ArgumentError: wrong number of arguments (3 for 2)
        from (irb):3:in `rjust'
        from (irb):3
irb(main):004:0>

It's expecting 2 parameters, but ignoring the padding argument and

using spaces.

Does anyone else see this?

M

--
Matt Mower :: http://matt.blogs.it/

boris:falcon:~:irb
irb(main):001:0> "0".rjust( 2, "-")
ArgumentError: wrong # of arguments(2 for 1)
       from (irb):1:in `rjust'
       from (irb):1
irb(main):002:0> "0".rjust( 2, "-", 22 )
ArgumentError: wrong # of arguments(3 for 1)
       from (irb):2:in `rjust'
       from (irb):2
irb(main):003:0>

Linux. Seeing something else.

Matt Mower <matt.mower@gmail.com> wrote in news:d5637319041220050544f98a42
@mail.gmail.com:

Does anyone else see this?

Nope.
ruby 1.8.1 (2003-12-25) [i386-mingw32]

kaspar

hand manufactured code - www.tua.ch/ruby

Ardanwen schrieb:

Matt Mower wrote:

Hi.

I'm using one-click-installer Ruby 1.8.2 (2004-11-06) on WinXP-SP1

and

I think I have a bug in the String method #rjust

irb(main):002:0> "0".rjust( 2, "-" )
=> " 0"
irb(main):003:0> "0".rjust( 2, "-", 22 )
ArgumentError: wrong number of arguments (3 for 2)
       from (irb):3:in `rjust'
       from (irb):3
irb(main):004:0>

It's expecting 2 parameters, but ignoring the padding argument and

using spaces.

Does anyone else see this?

M

--
Matt Mower :: http://matt.blogs.it/

>boris:falcon:~:irb
>irb(main):001:0> "0".rjust( 2, "-")
>ArgumentError: wrong # of arguments(2 for 1)
> from (irb):1:in `rjust'
> from (irb):1
>irb(main):002:0> "0".rjust( 2, "-", 22 )
>ArgumentError: wrong # of arguments(3 for 1)
> from (irb):2:in `rjust'
> from (irb):2
>irb(main):003:0>

Linux. Seeing something else.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

c:\>ruby -v
ruby 1.9.0 (2004-11-08) [i386-mswin32]

c:\>irb
irb(main):001:0> "0".rjust(2,"-")
=> "-0"
irb(main):002:0> quit

c:\>set path=c:\ruby182\bin;%PATH%

c:\>ruby -v
ruby 1.8.2 (2004-11-06) [i386-mswin32]

c:\>irb
irb(main):001:0> "0".rjust(2,"-")
=> " 0"
irb(main):002:0>

Regards,
Roland

"Ardanwen" <bvschmid@gmail.com> schrieb im Newsbeitrag
news:1103548501.911640.40570@f14g2000cwb.googlegroups.com...

Matt Mower wrote:
> Hi.
>
> I'm using one-click-installer Ruby 1.8.2 (2004-11-06) on WinXP-SP1
and
> I think I have a bug in the String method #rjust
>
> irb(main):002:0> "0".rjust( 2, "-" )
> => " 0"
> irb(main):003:0> "0".rjust( 2, "-", 22 )
> ArgumentError: wrong number of arguments (3 for 2)
> from (irb):3:in `rjust'
> from (irb):3
> irb(main):004:0>
>
> It's expecting 2 parameters, but ignoring the padding argument and
using spaces.
>
> Does anyone else see this?
>
> M
>
> --
> Matt Mower :: http://matt.blogs.it/

>boris:falcon:~:irb
>irb(main):001:0> "0".rjust( 2, "-")
>ArgumentError: wrong # of arguments(2 for 1)
> from (irb):1:in `rjust'
> from (irb):1
>irb(main):002:0> "0".rjust( 2, "-", 22 )
>ArgumentError: wrong # of arguments(3 for 1)
> from (irb):2:in `rjust'
> from (irb):2
>irb(main):003:0>

Linux. Seeing something else.

Works for me:

13:56:07 [source]: irbs

"0".rjust( 2 )

=> " 0"

"0".rjust( 2, "-")

=> "-0"

RUBY_VERSION

=> "1.8.1"

exit

14:17:53 [source]: uname -a
CYGWIN_NT-5.0 bond 1.5.12(0.116/4/2) 2004-11-10 08:34 i686 unknown unknown
Cygwin

Kind regards

    robert

* Ardanwen <bvschmid@gmail.com> [Dec 20, 2004 14:20]:

[rjust bug]

Linux. Seeing something else.

It's fixed in CVS,
  nikolai

···

--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}