I am using the Gtk3 gem. Following is my code:

#!/usr/bin/ruby -w
require 'gtk3'

class Object
    prepend Gtk
end

Application.new('org.gtk.example')

Result:

/home/sourav/gtk.rb:8:in `<main>': uninitialized constant Application (NameError)

But the following code works:

#!/usr/bin/ruby -w
require 'gtk3'

class Object
    prepend Gtk
    Gtk::Application
end

Application.new('org.gtk.example')

This doesn't have to be specifically Gtk::Application, it could be ::Gtk::ApplicationWindow under the prepend line. Why am I getting NameError without the Gtk::Application line?

0 Answers