about summary refs log tree commit homepage
path: root/lib/dtas.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-20 01:39:14 +0000
committerEric Wong <e@80x24.org>2020-01-06 08:15:13 +0000
commit940c0b3cffa7f691620e7890ada15c7519817307 (patch)
tree50674c3892983abdb78fa2a8597865edf6b05c79 /lib/dtas.rb
parent044d1e1777f37a77084794fadce86b4865a1ccfc (diff)
downloaddtas-940c0b3cffa7f691620e7890ada15c7519817307.tar.gz
sleepy_penguin requires a compiler and development headers to
install, so it could be a PITA to install for users on
distro-provided Ruby.  Allow fiddle since it's part of the Ruby
standard library since 1.9.2 and users won't have to install
anything else.
Diffstat (limited to 'lib/dtas.rb')
-rw-r--r--lib/dtas.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/dtas.rb b/lib/dtas.rb
index 7e9c0d5..ae2f815 100644
--- a/lib/dtas.rb
+++ b/lib/dtas.rb
@@ -25,6 +25,14 @@ module DTAS
     @null ||= File.open('/dev/null', 'r+')
   end
 
+  @libc = nil
+  def self.libc
+    @libc ||= begin
+      require 'fiddle'
+      Fiddle.dlopen(nil)
+    end
+  end
+
   # String#-@ will deduplicate strings when Ruby 2.5 is released (Dec 2017)
   # https://bugs.ruby-lang.org/issues/13077
   if RUBY_VERSION.to_f >= 2.5