方法内的警报不执行 - Alert doesn't execute inside a method

- 此内容更新于:2016-02-01
主题:

我试图让警报弹出在使用鞋Ruby方法,然而,警报并不执行。为什么警报不执行?有没有办法我可以让它执行代码的同时保持总体结构一样吗?

原文:

I am trying to make an alert pop-up from inside the method using Shoes for Ruby, however, the alert doesn't execute.

class ExampleClass
  def initialize (shoes)
    @shoes = shoes
  end
  def makeAlert (msg)
    @shoes.app do
      alert msg
    end
  end

end

Shoes.app do
  obj = ExampleClass.new self
  obj.makeAlert 'Hello'
end

Why would alert not execute? Is there a way I can make it execute while keeping general structure of the code the same?

网友:它没有必要添加“编辑:纠正错误”。只是修复它。如果我们需要知道什么时候/你在哪里改变了我们所知的东西。

(原文:It's not necessary to add "Edit: Corrected typo". Just fix it. If we need to know when/where you changed something we can tell.)

网友:你的问题是什么?

(原文:What is your question?)

楼主:@sawa警报不执行任何原因吗?

(原文:@sawa Any reason why alert doesn't execute?)