1 | require 'otaku' |
1 | require 'otaku' |
Of course, life is never as simple as the above, since we have Otaku.start accepts a proc, most people tend to code in-a-taken-for-granted-way taking advantage of contextual references:
1 | mark = '*' |
Now now, really unexpected rite ? The reason is that otaku converts the proc passed to Otaku.start, convert it to plain ruby code, & eval in the server process, thus, naturally, any contextual references are lost. As a workaround:
1 | Otaku.start(:mark => '*') do |data| |
Well, i must admit this workaround is abit not-so-comfortable ... anyway, i'm still thinking (hard) on how the contextual references can be extracted under the hood, without having user to go through the trouble of declaring the context hash explicitely. Anyway, this is what otaku has to offer for now :]
Have a look at this slightly more complicated usage of otaku.
No comments:
Post a Comment