String#% is not working on Ruby 1.8.7

To reproduce, I just copied the example right from ruby-doc
http://www.ruby-doc.org/core/classes/String.html#M001127 into irb
session.

“foo = %{foo}” % { :foo => ‘bar’ }
ArgumentError: malformed format string - %{
from (irb):1:in `%’
from (irb):1

I’m using
ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
on Ubuntu amd64

On Fri, Jan 7, 2011 at 1:02 AM, Vikrant C. [email protected]
wrote:

ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
on Ubuntu amd64

They changed the default Ruby on ruby-doc to 1.9.2, docs for 1.8.7 are
at
http://www.ruby-doc.org/core-1.8.7/classes/String.html#M000742

On Fri, Jan 7, 2011 at 12:23 AM, Josh C. [email protected]
wrote:

They changed the default Ruby on ruby-doc to 1.9.2, docs for 1.8.7 are at
http://www.ruby-doc.org/core-1.8.7/classes/String.html#M000742

I altered the RDoc template as well to show the Ruby version.

For example, the String class page, up at the top, should show

Class String
In: string.c
Ruby version: Ruby 1.9.2

for the default docs, and

http://www.ruby-doc.org/core-1.8.7/classes/String.html

has

Class String
In: string.c
Ruby version: Ruby 1.8.7

James

On Fri, Jan 7, 2011 at 10:35 PM, Markus F. [email protected]
wrote:

I always go the other way, since Google always found 1.8.6 docs, I only
knew
1.8.6 API, and I would see people use useful / cool methods that I
didn’t
even know about :stuck_out_tongue: I’m happy about this decision :slight_smile:

I’ve been hit by this a few times too. Usually I land in the middle of a
page through Google, and thus I always miss the “head” of the page when
I quickly want to look up things.

Would be nice if, when new features are introduced, they also get
document. In this case, .e.g.

str % arg - since Ruby 1.x.y
Support for hashes - since Ruby 1.9.2

  • Markus