lib/reline/terminfo.rb in reline-0.2.8.pre.11 vs lib/reline/terminfo.rb in reline-0.3.0
- old
+ new
@@ -1,7 +1,15 @@
-require 'fiddle'
-require 'fiddle/import'
+begin
+ require 'fiddle'
+ require 'fiddle/import'
+rescue LoadError
+ module Reline::Terminfo
+ def self.curses_dl
+ false
+ end
+ end
+end
module Reline::Terminfo
extend Fiddle::Importer
class TerminfoError < StandardError; end
@@ -48,10 +56,10 @@
end
end
@curses_dl = nil if @curses_dl == false
@curses_dl
end
-end
+end if not Reline.const_defined?(:Terminfo) or not Reline::Terminfo.respond_to?(:curses_dl)
module Reline::Terminfo
dlload curses_dl
#extern 'int setupterm(char *term, int fildes, int *errret)'
@setupterm = Fiddle::Function.new(curses_dl['setupterm'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_VOIDP], Fiddle::TYPE_INT)