You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You will notice that the output is wrong. Instantiating a Cow with a template for the first time is fine. But instantiating a Cow using another template, and then back to the first template, it doesn't work.
I am a very beginner in Ruby but I think this has to do with the class_eval you are doing in initialize.
I noticed this by building a small program that randomly selects a cow type at some point.
The text was updated successfully, but these errors were encountered:
thibaultcha
changed the title
Issue when instantiating multiple times a specific cow
Issue when instantiating multiple Cows with a specific cowfile
Aug 31, 2014
thibaultcha
changed the title
Issue when instantiating multiple Cows with a specific cowfile
Instantiating multiple Cows with a specific cowfile
Aug 31, 2014
Good catch. I'll admit, this whole thing is pretty gangster and could use some refactoring/updating especially for Ruby 2+. Instead of doing a class_eval, it should probably load the template per-instance of the cow.
You want to take a stab at fixing it? Otherwise I'll try to take care of this later this week or something.
Hi,
If you run this program:
You will notice that the output is wrong. Instantiating a Cow with a template for the first time is fine. But instantiating a Cow using another template, and then back to the first template, it doesn't work.
I am a very beginner in Ruby but I think this has to do with the
class_eval
you are doing ininitialize
.I noticed this by building a small program that randomly selects a cow type at some point.
The text was updated successfully, but these errors were encountered: