<CraigBuchek>
Hey, anyone used instance_eval successfully?
<CraigBuchek>
It doesn't seem to be setting self in the block like I'm expecting.
<CraigBuchek>
And the error message is for a line after the end of the file.
waj_ipad has joined #crystal-lang
waj_ipad has left #crystal-lang [#crystal-lang]
<waj>
can you share some code?
<CraigBuchek>
Working on it.
<CraigBuchek>
Will probably file a GitHub issue. Probably something I'm doing wrong.
<waj>
cool
<CraigBuchek>
Trying to get the smallest example I can, and also the equivalent Ruby.
<waj>
We only used it a few times so it might have bugs
<CraigBuchek>
Seems like I'm misunderstanding the Ruby too. :(
<CraigBuchek>
I don't see any code using instance_eval. Only a couple even using block.call.
<waj>
in crystal the instance_eval is done using the with/yield keyword
<waj>
check html/builder.cr
<waj>
I thought you were talking about that :)
asterite has joined #crystal-lang
<CraigBuchek>
Got a work-around. Just did `with self yield` manually. That didn't set `self` in the block I'm yielding to, but does seem to allow finding the methods to create a DSL like I wanted.