Bugs in Examples

Yesterday, I installed vr via rubygems on my 64bit Linux Mint 13
(~Ubuntu 12.04) with ruby-2.0.0-p247 installed via rvm, and the
calculator example and the child_window example crash when I click on
the buttons.

As for the calculator example, it’s caused by trivial typos in
‘bin/Calculator.rb’ which are easily fixed by modifying the
keys__clicked method to look as follows:

def keys__clicked(button)
case button.label
when “C” then @builder[“display”].text = “”
when “=” then
begin # this doesn’t catch all errors
@builder[“display”].text =
eval(@builder[“display”].text).to_s
rescue
@builder[“display”].text = “error”
end
else @builder[“display”].text = @builder[“display”].text +
button.label
end
end

I don’t have any nonhacky fix for the child_window example.

Cheers
ThorX89

Hi:

Thanks for reporting this. You’re right. There is a typo in the
Calculator example:

@builder[“display.text”]

Should be:

@builder[“display”].text

I will fix it in the next release.

I’m checking on the other one now.

Eric

Ok. It’s fixed, and v 1.0.16 has been pushed ro rubygems.org.

Thanks!

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs