# Syntax error from element.rb

**URL:** <https://www.ruby-forum.com/t/syntax-error-from-element-rb/173070>\
**Category:** Ruby\
**Created:** [August 1, 2009, 5:46pm UTC](https://www.ruby-forum.com/t/syntax-error-from-element-rb/173070 "2009-08-01T17:46:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grimble](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ba0ec/32.png) [@Grimble](https://www.ruby-forum.com/u/Grimble)\
**Post date:** [August 1, 2009, 5:46pm UTC](https://www.ruby-forum.com/t/syntax-error-from-element-rb/173070/1 "2009-08-01T17:46:00Z")

</div>

Not a regular Ruby developer.  
Rebuilding a Ruby environment after moving from Mandriva 2008.0 to  
2009.1.

ruby 1.8.7 (2008-08-11 patchlevel 72) [i586-linux]  
ruby-svg-1.0.2  
I get the following error trace  
/usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in  
`gem_original_require': /usr/lib/ruby/site_ruby/1.8/svg/element.rb:423: syntax error, unexpected $undefined (SyntaxError) svg << %| textLength="#{@}"| if @length ^ /usr/lib/ruby/site_ruby/1.8/svg/element.rb:430: syntax error, unexpected kEND, expecting '}' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in`require’  
from /usr/lib/ruby/site\_ruby/1.8/svg/svg.rb:9  
from  
/usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in  
`gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in`require’  
from /home/graeme/Software/weather/devel/svgwind.rb:2

where svgwind.rb:2 says  
require ‘svg/svg’

Version information:

# $Id: element.rb,v 1.9 2002/11/12 11:32:40 rcn Exp $

Is this some sort of version compatibility issue? There was no such  
problem under the previous environment.  
Any help welcome.  
Grimble

---

<div class="post-metadata">

**Author:** ![Grimble](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ba0ec/32.png) [@Grimble](https://www.ruby-forum.com/u/Grimble)\
**Post date:** [August 1, 2009, 6:09pm UTC](https://www.ruby-forum.com/t/syntax-error-from-element-rb/173070/2 "2009-08-01T18:09:25Z")

</div>

Grimble wrote:

> ```
> ^
> 
> ```

svg \<\< %| textLength="#{@}"| if @length

isn’t legal Ruby. The @ can’t stand alone. It’s a prefix indicating an  
instance variable, like “@length”. I don’t know why it wasn’t being  
diagnosed before. It looks like an search-and-replace error of some  
sort.

---

<div class="post-metadata">

**Author:** ![Grimble](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ba0ec/32.png) [@Grimble](https://www.ruby-forum.com/u/Grimble)\
**Post date:** [August 1, 2009, 9:19pm UTC](https://www.ruby-forum.com/t/syntax-error-from-element-rb/173070/3 "2009-08-01T21:19:02Z")

</div>

Grimble wrote:

> Tim, thanks for a quick reply.  
> I checked back to the previous version:
> 
> # $Id: element.rb,v 1.14 2003/02/06 14:59:43 yuya Exp $
> 
> The corresponding line was indeed:  
> svg \<\< %| textLength="#{@length}"| if @length  
> So, I shall make the appropriate edit and retry.  
> Does this need to be reported as a bug?

I don’t see why not. The developer will probably thank you for it.

---

<div class="post-metadata">

**Author:** ![Grimble](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ba0ec/32.png) [@Grimble](https://www.ruby-forum.com/u/Grimble)\
**Post date:** [August 1, 2009, 6:35pm UTC](https://www.ruby-forum.com/t/syntax-error-from-element-rb/173070/4 "2009-08-01T18:35:46Z")

</div>

Tim H. wrote:

> > ```
> > svg << %| textLength="#{@}"| if @length
> > ^
> > 
> > ```
> 
> svg \<\< %| textLength="#{@}"| if @length
> 
> isn’t legal Ruby. The @ can’t stand alone. It’s a prefix indicating an  
> instance variable, like “@length”. I don’t know why it wasn’t being  
> diagnosed before. It looks like an search-and-replace error of some sort.

Tim, thanks for a quick reply.  
I checked back to the previous version:

# $Id: element.rb,v 1.14 2003/02/06 14:59:43 yuya Exp $

The corresponding line was indeed:  
svg \<\< %| textLength="#{@length}"| if @length  
So, I shall make the appropriate edit and retry.  
Does this need to be reported as a bug?  
Regards  
Grimble
