gobject-introspection 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,19 +17,22 @@
17
17
  module GObjectIntrospection
18
18
  class Loader
19
19
  class << self
20
- def load(namespace, base_module)
20
+ def load(namespace, base_module, options={})
21
21
  loader = new(base_module)
22
+ loader.version = options[:version]
22
23
  loader.load(namespace)
23
24
  end
24
25
  end
25
26
 
27
+ attr_accessor :version
26
28
  def initialize(base_module)
27
29
  @base_module = base_module
30
+ @version = nil
28
31
  end
29
32
 
30
33
  def load(namespace)
31
34
  repository = Repository.default
32
- repository.require(namespace)
35
+ repository.require(namespace, @version)
33
36
  pre_load(repository, namespace)
34
37
  repository.each(namespace) do |info|
35
38
  load_info(info)
@@ -72,7 +75,8 @@ module GObjectIntrospection
72
75
 
73
76
  def define_module_function(target_module, name, function_info)
74
77
  validate = lambda do |arguments|
75
- validate_arguments(function_info, arguments)
78
+ method_name = "#{target_module}\#.#{name}"
79
+ validate_arguments(function_info, method_name, arguments)
76
80
  end
77
81
  target_module.module_eval do
78
82
  define_method(name) do |*arguments, &block|
@@ -181,13 +185,13 @@ module GObjectIntrospection
181
185
  def load_constructor_infos(infos, klass)
182
186
  return if infos.empty?
183
187
 
184
- validate = lambda do |info, arguments|
185
- validate_arguments(info, arguments)
188
+ validate = lambda do |info, method_name, arguments|
189
+ validate_arguments(info, "#{klass}\##{method_name}", arguments)
186
190
  end
187
191
  infos.each do |info|
188
192
  name = "initialize_#{info.name}"
189
193
  klass.__send__(:define_method, name) do |*arguments, &block|
190
- validate.call(info, arguments, &block)
194
+ validate.call(info, name, arguments, &block)
191
195
  info.invoke(self, *arguments, &block)
192
196
  end
193
197
  klass.__send__(:private, name)
@@ -202,7 +206,7 @@ module GObjectIntrospection
202
206
  end
203
207
  end
204
208
 
205
- def validate_arguments(info, arguments)
209
+ def validate_arguments(info, method_name, arguments)
206
210
  n_in_args = info.n_in_args
207
211
  n_required_in_args = info.n_required_in_args
208
212
  return if (n_required_in_args..n_in_args).cover?(arguments.size)
@@ -213,7 +217,8 @@ module GObjectIntrospection
213
217
  else
214
218
  detail << "#{info.n_required_in_args}..#{info.n_in_args}"
215
219
  end
216
- raise ArgumentError, "wrong number of arguments (#{detail})"
220
+ message = "#{method_name}: wrong number of arguments (#{detail})"
221
+ raise ArgumentError, message
217
222
  end
218
223
 
219
224
  def find_suitable_callable_info(infos, arguments)
@@ -272,7 +277,7 @@ module GObjectIntrospection
272
277
 
273
278
  def load_method_info(info, klass, method_name)
274
279
  validate = lambda do |arguments|
275
- validate_arguments(info, arguments)
280
+ validate_arguments(info, "#{klass}\##{method_name}", arguments)
276
281
  end
277
282
  klass.__send__(:define_method, method_name) do |*arguments, &block|
278
283
  validate.call(arguments, &block)
@@ -290,7 +295,7 @@ module GObjectIntrospection
290
295
  next if name == "new"
291
296
  next if name == "alloc"
292
297
  validate = lambda do |arguments|
293
- validate_arguments(info, arguments)
298
+ validate_arguments(info, "#{klass}.#{name}", arguments)
294
299
  end
295
300
  singleton_class = (class << klass; self; end)
296
301
  singleton_class.__send__(:define_method, name) do |*arguments, &block|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobject-introspection
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-17 00:00:00.000000000 Z
12
+ date: 2013-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: glib2
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.2.3
21
+ version: 1.2.4
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.2.3
29
+ version: 1.2.4
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: test-unit
32
32
  requirement: !ruby/object:Gem::Requirement