module NIO

New I/O for Ruby

Released under the MIT License. Copyright, 2016, by Upekshe Jayasekera. Copyright, 2016-2017, by Tony Arcieri. Copyright, 2020, by Thomas Dziedzic. Copyright, 2023, by Samuel Williams.

Released under the MIT License. Copyright, 2011-2018, by Tony Arcieri. Copyright, 2015, by Upekshe Jayasekera. Copyright, 2015, by Vladimir Kochnev. Copyright, 2018-2023, by Samuel Williams. Copyright, 2019-2020, by Gregory Longtin.

Released under the MIT License. Copyright, 2011-2018, by Tony Arcieri. Copyright, 2018-2023, by Samuel Williams. Copyright, 2023, by Tsimnuj Hawj.

Constants

ENGINE
VERSION

Public Class Methods

engine() click to toggle source

NIO implementation, one of the following (as a string):

  • select: in pure Ruby using Kernel.select

  • libev: as a C extension using libev

  • java: using Java NIO

# File lib/nio.rb, line 21
def self.engine
  ENGINE
end
pure?(env = ENV) click to toggle source
# File lib/nio.rb, line 25
def self.pure?(env = ENV)
  # The user has explicitly opted in to non-native implementation:
  if env["NIO4R_PURE"] == "true"
    return true
  end

  # Native Ruby on Windows is not supported:
  if (Gem.win_platform? && !defined?(JRUBY_VERSION))
    return true
  end

  # M1 native extension is crashing on M1 (arm64):
  # if RUBY_PLATFORM =~ /darwin/ && RUBY_PLATFORM =~ /arm64/
  #   return true
  # end

  return false
end