Class: GLib::Instantiatable

Inherits:
Object
  • Object
show all
Defined in:
lib/glib2.rb,
ext/glib2/rbgobj_typeinstance.c

Class Method Summary collapse

Class Method Details

.method_added(name) ⇒ Object



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/glib2.rb', line 136

def method_added(name)
  super

  case name.to_s
  when /\A#{Regexp.escape(SIGNAL_HANDLER_PREFIX)}/o
    signal_name = $POSTMATCH
    begin
      signal_ = signal(signal_name)
    rescue NoSignalError
      return
    end
    return unless signal_.class != self
    signal_handler_attach(signal_, name.to_s) do |instance, *args|
      instance.__send__(name, *args)
    end
  when /\A#{Regexp.escape(VIRTUAL_FUNCTION_IMPLEMENTATION_PREFIX)}/o
    ancestors.each do |klass|
      next unless klass.respond_to?(:implement_virtual_function)
      return if klass.implement_virtual_function(self, name)
    end
  end
end