ffi-extra 0.0.1 → 0.0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/ffi/extra.rb +4 -4
  2. metadata +1 -1
data/lib/ffi/extra.rb CHANGED
@@ -32,7 +32,7 @@ module FFI
32
32
  def self.type_size (type)
33
33
  type = FFI.find_type(type) if type.is_a?(Symbol)
34
34
 
35
- if type.is_a?(Class) && type.ancestors.member?(FFI::Struct) || type.ancestors.member?(FFI::ManagedStruct) || type.ancestors.member?(Type::Builtin)
35
+ if type.is_a?(Type::Builtin) || type.is_a?(Class) && type.ancestors.member?(FFI::Struct) || type.ancestors.member?(FFI::ManagedStruct)
36
36
  type.size
37
37
  elsif type.respond_to? :from_native
38
38
  type.native_type.size
@@ -91,10 +91,10 @@ module FFI
91
91
  end
92
92
  end
93
93
 
94
- if type.is_a?(Class) && type.ancestors.member?(FFI::Struct) && !type.ancestors.member?(FFI::ManagedStruct)
95
- type.new(self)
96
- elsif type.is_a?(Type::Builtin)
94
+ if type.is_a?(Type::Builtin)
97
95
  send "read_#{type.name.downcase}"
96
+ elsif type.is_a?(Class) && type.ancestors.member?(FFI::Struct) && !type.ancestors.member?(FFI::ManagedStruct)
97
+ type.new(self)
98
98
  elsif type.respond_to? :from_native
99
99
  type.from_native(typecast(type.native_type), nil)
100
100
  else
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ffi-extra
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - meh.