Module: QML::Reactive

Extended by:
ClassMethods
Included in:
Access
Defined in:
lib/qml/reactive.rb

Defined Under Namespace

Modules: ClassMethods Classes: PropertyInfo, SignalInfo

Instance Method Summary collapse

Methods included from ClassMethods

properties, property_infos, signal_infos, signals

Instance Method Details

#initialize(*args, &block) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/qml/reactive.rb', line 21

def initialize(*args, &block)

  self.class.property_infos.each do |name, info|
    if info.initializer
      self.__send__ :"#{name}=", instance_eval(&info.initializer)
    end
  end

  self.class.signal_infos.each do |name, info|
    __send__(name).connect do |*args|
      info.listeners.each do |listener|
        instance_exec(*args, &listener)
      end
    end
  end

  super
end