Ruby + Tk command binding - scope issue?

后端 未结 2 999
花落未央
花落未央 2021-01-14 01:04

So I have this app

require \'tk\'
class Foo
  def my_fancy_function
    puts \"hello, world!\"
  end

  def initialize
    @root = TkRoot.new{title \"Hello,          


        
2条回答
  •  梦谈多话
    2021-01-14 01:44

    If you put a

    p self
    

    into the do ... end block of your code, then you'll probably find out that the current scope is different than your Foo object.

提交回复
热议问题