34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/qml/access.rb', line 34
def meta_object
@meta_object ||= begin
exporter = Exporter.new(self, name)
signals = self.signals.grep(ALLOWED_PATTERN)
properties = self.properties.grep(ALLOWED_PATTERN)
signals.each do |signal|
exporter.add_signal(signal, signal_infos[signal].params)
end
properties.each do |prop|
exporter.add_property(prop, :"#{prop}_changed")
end
methods = ancestors.take_while { |k| k.include?(Access) }
.map { |k| k.instance_methods(false) }.inject(&:|)
.grep(ALLOWED_PATTERN)
ignored_methods = signals | properties.flat_map { |p| [p, :"#{p}=", :"#{p}_changed"] }
(methods - ignored_methods).each do |method|
instance_method = self.instance_method(method)
if instance_method.arity >= 0
exporter.add_method(method, instance_method.arity)
end
end
exporter.to_meta_object
end
end
|