
March 31st, 2008, 12:17 PM
|
|
Contributing User
|
|
Join Date: Jan 2004
Location: Constant Limbo
|
|
You have teh wrong closing tag
Code:
irb(main):001:0> require 'erb'
=> true
irb(main):002:0> tmplt1 = "Some text <%= $value =>\n"
=> "Some text <%= $value =>\n"
irb(main):003:0> tmplt2 = "Some text <%= $value %>\n"
=> "Some text <%= $value %>\n"
irb(main):004:0> t1 = ERB.new(tmplt1)
=> #<ERB:0xb7f44f40 @src="_erbout = ''; _erbout.concat \"Some text \"; _erbout.concat \" $value =>\\n\"; _erbout", @filename=nil, @safe_level=nil>
irb(main):005:0> t2 = ERB.new(tmplt2)
=> #<ERB:0xb7f42344 @src="_erbout = ''; _erbout.concat \"Some text \"; _erbout.concat(( $value ).to_s); _erbout.concat \"\\n\"\n_erbout", @filename=nil, @safe_level=nil>
irb(main):009:0> $value = 42
=> 42
irb(main):010:0> t1.run
Some text $value =>
=> nil
irb(main):011:0> t2.run
Some text 42
=> nil
irb(main):012:0>
I've bolded the relevant sections above
__________________
True happiness is not getting what you want, it's wanting what you've already got.
My Blog
|