File: io_extensions.rb

package info (click to toggle)
ruby-ffi-rzmq 2.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 392 kB
  • sloc: ruby: 2,992; sh: 21; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 335 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class IO
  if defined? JRUBY_VERSION
    require 'jruby'
    def posix_fileno
      case self
      when STDIN, $stdin
        0
      when STDOUT, $stdout
        1
      when STDERR, $stderr
        2
      else
        JRuby.reference(self).getOpenFile().getFileno
      end
    end
  else
    alias :posix_fileno :fileno
  end
end