Hi list: I run the ri''s ERB doc 1st sample 1. require ''erb'' 2. x = 42 3. template = ERB.new <<-EOF 4. The value of x is: 5. EOF 6. puts template.result(binding) the doc say it will print "The value of x is: 42" but my irb print "nil" and there is a "=> #<ERB:0x2970b24 @src="_erbout = ''''; _erbout.concat \" The value of x is: \\n\"\n_erbout", @filename=nil, @safe_level=nil>" at the end of 5th line. Why?hun.. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060725/709f7172/attachment.html
ri says: require ''erb'' x = 42 template = ERB.new <<-EOF The value of x is: <%= x %> EOF puts template.result(binding) My wild guess would be that you are using html output of ri command which doesn''t correctly escape <,> characters. On 7/25/06, Harry Huang <huangliang@usrgroup.com> wrote:> > > > > Hi list: > > I run the ri''s ERB doc 1st sample 1. require ''erb'' > > 2. x = 42 > > 3. template = ERB.new <<-EOF > > 4. The value of x is: > > > 5. EOF > 6. puts template.result(binding) > > > > the doc say it will print > > "The value of x is: 42" > > > > but my irb print "nil" and there is a > > "=> #<ERB:0x2970b24 @src="_erbout = ''''; _erbout.concat \" The value of x > is: \\n\"\n_erbout", @filename=nil, @safe_level=nil>" > > at the end of 5th line. > > > > Why?hun.. > > > > > > Thanks > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Kent --- http://www.datanoise.com
Thanks. It?s work well now:) I use the RDT''s ri view to lookup api, there''s any other way to look api and will not loose information? -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Kent Sibilev Sent: 2006?7?25? 12:43 To: rails@lists.rubyonrails.org Subject: Re: [Rails] about ERB sample ri says: require ''erb'' x = 42 template = ERB.new <<-EOF The value of x is: <%= x %> EOF puts template.result(binding) My wild guess would be that you are using html output of ri command which doesn''t correctly escape <,> characters. On 7/25/06, Harry Huang <huangliang@usrgroup.com> wrote:> > > > > Hi list: > > I run the ri''s ERB doc 1st sample 1. require ''erb'' > > 2. x = 42 > > 3. template = ERB.new <<-EOF > > 4. The value of x is: > > > 5. EOF > 6. puts template.result(binding) > > > > the doc say it will print > > "The value of x is: 42" > > > > but my irb print "nil" and there is a > > "=> #<ERB:0x2970b24 @src="_erbout = ''''; _erbout.concat \" The value ofx> is: \\n\"\n_erbout", @filename=nil, @safe_level=nil>" > > at the end of 5th line. > > > > Why?hun.. > > > > > > Thanks > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Kent --- http://www.datanoise.com _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails
Just use terminal I guess. $ ri ERB On 7/25/06, huangliang <huangliang2211@sohu.com> wrote:> Thanks. It''s work well now:) > I use the RDT''s ri view to lookup api, there''s any other way to look api and > will not loose information? > > -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Kent Sibilev > Sent: 2006?7?25? 12:43 > To: rails@lists.rubyonrails.org > Subject: Re: [Rails] about ERB sample > > ri says: > > require ''erb'' > > x = 42 > template = ERB.new <<-EOF > The value of x is: <%= x %> > EOF > puts template.result(binding) > > My wild guess would be that you are using html output of ri command > which doesn''t correctly escape <,> characters. > > On 7/25/06, Harry Huang <huangliang@usrgroup.com> wrote: > > > > > > > > > > Hi list: > > > > I run the ri''s ERB doc 1st sample 1. require ''erb'' > > > > 2. x = 42 > > > > 3. template = ERB.new <<-EOF > > > > 4. The value of x is: > > > > > > 5. EOF > > 6. puts template.result(binding) > > > > > > > > the doc say it will print > > > > "The value of x is: 42" > > > > > > > > but my irb print "nil" and there is a > > > > "=> #<ERB:0x2970b24 @src="_erbout = ''''; _erbout.concat \" The value of > x > > is: \\n\"\n_erbout", @filename=nil, @safe_level=nil>" > > > > at the end of 5th line. > > > > > > > > Why?hun.. > > > > > > > > > > > > Thanks > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > -- > Kent > --- > http://www.datanoise.com > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Kent --- http://www.datanoise.com