Sha256: 3aee4deebd6a17433be8ac862e757265208462e1d43119068a48f9b972cfd1b3

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Support
    ##
    # @api private
    #
    class Ruby
      class << self
        ##
        # @return [ConvenientService::Support::Version]
        #
        # @internal
        #   https://ruby-doc.org/core-2.7.2/doc/globals_rdoc.html
        #
        def version
          @version ||= Support::Version.new(::RUBY_VERSION)
        end

        ##
        # Returns `true` when JRuby, `false` otherwise.
        #
        # @return [Boolean]
        #
        # @see https://github.com/rdp/os
        #
        # @internal
        #   NOTE: Gratefully copied from the `os` gem. Version `1.1.4`.
        #   - https://github.com/rdp/os/blob/v1.1.4/lib/os.rb#L101
        #
        #   NOTE: Modified original implementation in order to return a boolean.
        #
        def jruby?
          ::RUBY_PLATFORM.to_s.match?(/java/)
        end

        ##
        # Returns `true` when TruffleRuby, `false` otherwise.
        #
        # @return [Boolean]
        #
        # @internal
        #   NOTE: Taken from irb testing. May NOT be stable.
        #
        #   TODO: Find a confirmation of stability.
        #
        def truffleruby?
          ::RUBY_ENGINE.to_s.match?(/truffleruby/)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
convenient_service-0.18.0 lib/convenient_service/support/ruby.rb
convenient_service-0.17.0 lib/convenient_service/support/ruby.rb
convenient_service-0.16.0 lib/convenient_service/support/ruby.rb
convenient_service-0.15.0 lib/convenient_service/support/ruby.rb
convenient_service-0.14.0 lib/convenient_service/support/ruby.rb
convenient_service-0.13.0 lib/convenient_service/support/ruby.rb
convenient_service-0.12.0 lib/convenient_service/support/ruby.rb