PDA

View Full Version : Ruby and Shoes - code example problem



samjh
March 26th, 2010, 03:33 PM
I'm pretty new to Ruby, and have encountered a problem with one of the code examples for Shoes. The problem is with the Clock example here: http://shoes.heroku.com/

The error is in the third line:

every 1 do
The Shoes interpreter says "undefined method 'every'".

Google searches aren't helping, because "every" is such a common word, although I've come across other code examples on the web that use the "every" keyword. Could someone enlighten me, please?

stylishpants
March 26th, 2010, 11:24 PM
"every" is not a built-in keyword of ruby. It must be a method definition from shoes.

Probably you need to 'require' some library before that code will work.

samjh
March 27th, 2010, 02:10 AM
That's strange, because none of the code examples use 'require' - on the Shoes official website or other websites. Also, the "every" method is used in non-Shoes applications too.