ffi-extra 0.0.4 → 0.0.5

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.
Files changed (2) hide show
  1. data/lib/ffi/extra.rb +15 -1
  2. metadata +4 -4
@@ -23,6 +23,20 @@ module FFI
23
23
  end
24
24
  end
25
25
 
26
+ @loader = Class.new {
27
+ extend FFI::Library
28
+
29
+ ffi_lib FFI::Library::CURRENT_PROCESS
30
+ }
31
+
32
+ def self.load (path)
33
+ @loader.instance_eval { ffi_lib_add path }
34
+ end
35
+
36
+ def self.function (function, arguments = [], ret = :void)
37
+ @loader.instance_eval { attach_function function, arguments, ret }
38
+ end
39
+
26
40
  module Library
27
41
  def ffi_lib_add (*names)
28
42
  ffi_lib *((begin
@@ -151,7 +165,7 @@ module FFI
151
165
  find_type(:ssize_t) rescue typedef(:long, :ssize_t)
152
166
  end
153
167
 
154
- [Integer, String, NilClass, TrueClass, FalseClass, FFI::Pointer].each {|klass|
168
+ [Numeric, String, NilClass, TrueClass, FalseClass, FFI::Pointer].each {|klass|
155
169
  klass.instance_eval {
156
170
  define_method :to_ffi do
157
171
  self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-extra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-28 00:00:00.000000000 Z
12
+ date: 2011-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
16
- requirement: &15812500 !ruby/object:Gem::Requirement
16
+ requirement: &5577320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15812500
24
+ version_requirements: *5577320
25
25
  description:
26
26
  email: meh@paranoici.org
27
27
  executables: []