Bugs item #7379, was opened at 2006-12-19 22:09
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=7379&group_id=426

Category: Documentation, ri, and rdoc
Group: 1.8.x
Status: Open
Resolution: None
Priority: 3
Submitted By: Daniel Berger (djberg96)
>Assigned to: Eric Hodel (drbrain)
Summary: String#slice! documentation bug

Initial Comment:
Hi,

The documentation for String#slice! says, "The forms that take a Fixnum will raise an IndexError if the value is out of range; the Range form will raise a RangeError..."

However, I cannot duplicate this behavior. Whenever I try to force an
IndexError, for example, I just get back nil, i.e. the same behavior as String.slice.

irb(main):001:0> VERSION
=> "1.8.4"
irb(main):002:0> s = "hello"
=> "hello"
irb(main):003:0> s.slice!(-5,-99)
=> nil
irb(main):004:0> s
=> "hello"
irb(main):005:0> s.slice!(-5,100)
=> "hello"
irb(main):006:0> s
=> ""

I've filed this as a documentation bug, but I suppose it could be an implementation bug, since I'm not sure what the desired behavior is.

Regards,

Dan

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=7379&group_id=426