Module: Reline::Terminfo
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Exceptions:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Fiddle::Importer,
Fiddle::Importer
|
|
Defined in: | lib/reline/terminfo.rb, lib/reline/terminfo.rb, lib/reline/terminfo.rb |
Class Attribute Summary
-
.enabled? ⇒ Boolean
readonly
NOTE: This means Fiddle and curses are enabled.
- .term_supported? ⇒ Boolean readonly
Class Method Summary
Class Attribute Details
.enabled? ⇒ Boolean
(readonly)
NOTE: This means Fiddle and curses are enabled.
See additional method definition at line 145.
# File 'lib/reline/terminfo.rb', line 155
def self.enabled? true end
.term_supported? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/reline/terminfo.rb', line 149
def self.term_supported? @term_supported end
Class Method Details
.curses_dl
[ GitHub ]# File 'lib/reline/terminfo.rb', line 37
def self.curses_dl return @curses_dl unless @curses_dl == false if Fiddle.const_defined?(:TYPE_VARIADIC) curses_dl_files.each do |curses_name| result = Fiddle::Handle.new(curses_name) rescue Fiddle::DLError next else @curses_dl = result break end end @curses_dl = nil if @curses_dl == false @curses_dl end
.curses_dl_files
[ GitHub ]# File 'lib/reline/terminfo.rb', line 22
def self.curses_dl_files case RUBY_PLATFORM when /mingw/, /mswin/ # aren't supported [] when /cygwin/ %w[cygncursesw-10.dll cygncurses-10.dll] when /darwin/ %w[libncursesw.dylib libcursesw.dylib libncurses.dylib libcurses.dylib] else %w[libncursesw.so libcursesw.so libncurses.so libcurses.so] end end
.setupterm(term, fildes)
[ GitHub ]# File 'lib/reline/terminfo.rb', line 85
def self.setupterm(term, fildes) errret_int = Fiddle::Pointer.malloc(Fiddle::SIZEOF_INT, Fiddle::RUBY_FREE) ret = @setupterm.(term, fildes, errret_int) case ret when 0 # OK @term_supported = true when -1 # ERR @term_supported = false end end
.tigetflag(capname)
# File 'lib/reline/terminfo.rb', line 120
def self.tigetflag(capname) raise TerminfoError, "capname is not String: #{capname.inspect}" unless capname.is_a?(String) flag = @tigetflag.(capname).to_i case flag when -1 raise TerminfoError, "not boolean capability: #{capname}" when 0 raise TerminfoError, "can't find capability: #{capname}" end flag end
.tigetnum(capname)
# File 'lib/reline/terminfo.rb', line 132
def self.tigetnum(capname) raise TerminfoError, "capname is not String: #{capname.inspect}" unless capname.is_a?(String) num = @tigetnum.(capname).to_i case num when -2 raise TerminfoError, "not numeric capability: #{capname}" when -1 raise TerminfoError, "can't find capability: #{capname}" end num end
.tigetstr(capname)
# File 'lib/reline/terminfo.rb', line 102
def self.tigetstr(capname) raise TerminfoError, "capname is not String: #{capname.inspect}" unless capname.is_a?(String) capability = @tigetstr.(capname) case capability.to_i when 0, -1 raise TerminfoError, "can't find capability: #{capname}" end StringWithTiparm.new(capability.to_s) end
.tiparm(str, *args)
[ GitHub ]# File 'lib/reline/terminfo.rb', line 112
def self.tiparm(str, *args) new_args = [] args.each do |a| new_args << Fiddle::TYPE_INT << a end @tiparm.(str, *new_args).to_s end