Sha256: 48a25cc362a214b8f3acf9f5cfa2af743cc5ae65310c01eb89e1e0eb77fa6b26

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

module FasterPath
  module Platform
    class << self
      def ffi_library
        file = [
          lib_prefix,
          "faster_path.",
          lib_suffix
        ]

        File.join(rust_release, file.join())
      end

      def operating_system
        case host_os()
        when /linux|bsd|solaris/
          "linux"
        when /darwin/
          "darwin"
        when /mingw|mswin/
          "windows"
        else
          host_os()
        end
      end

      def lib_prefix
        case operating_system()
        when /windows/
          ''
        when /cygwin/
          'cyg'
        else
          'lib'
        end
      end

      def lib_suffix
        case operating_system()
        when /darwin/
          'dylib'
        when /linux/
          'so'
        when /windows|cygwin/
          'dll'
        else
          'so'
        end
      end

      def rust_release
        File.expand_path("../../target/release/", __dir__)
      end

      def host_os
        RbConfig::CONFIG['host_os'].downcase
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
faster_path-0.2.6 lib/faster_path/platform.rb
faster_path-0.2.5 lib/faster_path/platform.rb
faster_path-0.2.4 lib/faster_path/platform.rb