ffi-module 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0966d9341e590e8623b6e5f8b46672e1258e64d76c4b5a623fed1153d982ca97'
4
- data.tar.gz: 7c0d82c153c368cce300aa8e2e4cf45f1f2135707974d4a3da0c1f0ff6bb7aea
3
+ metadata.gz: 979a10f28449ee33ceecb9e1b11c31604c62d3d69787d9b00d48fc75c847eb91
4
+ data.tar.gz: 8584ea6b4f362bf4f68ecfdf33ec05b2212469ffc89e2b928407e05b3156178a
5
5
  SHA512:
6
- metadata.gz: cfc6f8d0f8d137fed89851a1b94a456b11641dc60289c80fe2122ae8b4dff21ac8144cdd1b92da35a4de9a5e8cd5990ab75c1856f70a0af34257b06f0eff322c
7
- data.tar.gz: d4306604e74a7f8211d4acfa6c2eef9e7e53ae45c9807d8a0b1e2313959a82546664708633bf108f1fc98a52eece56bf6a253d67de6e1fb46335f05066a86b4d
6
+ metadata.gz: 0106cd144f20ed3bffdc8093f759f80b7c3011990623382edf13bba5d2158f2af83c930570d54d1b82a2d286301428db6aba87d3c8961ddc15c427bb547ae201
7
+ data.tar.gz: bdf29ffe1d98fc704b45851c05836d0c94946a9f410a031c44dafab5caf01cad185316fc0b5f8afdb012821422be24fb1754453e415bc20e9e665636d450fe5d
@@ -172,6 +172,29 @@ module FFI
172
172
  ffi_define_generic_enumeration(name, FFI::Bitmask, native_type, *arguments)
173
173
  end
174
174
 
175
+ def ffi_find_type(argument)
176
+ if argument.kind_of?(Type)
177
+ return argument
178
+ end
179
+
180
+ if type = @ffi_type_map[argument]
181
+ return type
182
+ end
183
+
184
+ if argument.is_a?(Class) && argument < Struct
185
+ return Type::POINTER
186
+ end
187
+
188
+ if argument.is_a?(DataConverter)
189
+ # Cache the mapped type:
190
+ return ffi_define_type(argument, Type::Mapped.new(argument))
191
+ end
192
+
193
+ if argument
194
+ return FFI.find_type(argument)
195
+ end
196
+ end
197
+
175
198
  private
176
199
 
177
200
  def ffi_define_generic_enumeration(name, klass, native_type, values)
@@ -213,29 +236,6 @@ module FFI
213
236
 
214
237
  return result
215
238
  end
216
-
217
- def ffi_find_type(argument)
218
- if argument.kind_of?(Type)
219
- return argument
220
- end
221
-
222
- if type = @ffi_type_map[argument]
223
- return type
224
- end
225
-
226
- if argument.is_a?(Class) && argument < Struct
227
- return Type::POINTER
228
- end
229
-
230
- if argument.is_a?(DataConverter)
231
- # Cache the mapped type:
232
- return ffi_define_type(argument, Type::Mapped.new(argument))
233
- end
234
-
235
- if argument
236
- return FFI.find_type(argument)
237
- end
238
- end
239
239
  end
240
240
  end
241
241
  end
@@ -31,6 +31,6 @@ end
31
31
 
32
32
  module FFI
33
33
  module Module
34
- VERSION = "0.1.1"
34
+ VERSION = "0.1.2"
35
35
  end
36
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-module
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
- rubygems_version: 3.2.3
114
+ rubygems_version: 3.0.3
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: Write a short summary, because RubyGems requires one.