Sha256: 12a439253692aa9c23913de5f2774836b7e30eb5e2c6949f1e031f89303b9003

Contents?: true

Size: 564 Bytes

Versions: 1

Compression:

Stored size: 564 Bytes

Contents

require "faster_path/version"
require "ffi"

module FasterPath
  def self.absolute?(pth)
    Rust.absolute(pth)
  end

  def self.monkeypatch_pathname
    class << ::Pathname
      def absolute?
        FasterPath.absolute?(@path)
      end
    end
  end

  module RefinePathname
    refine Pathname do
      def absolute?
        FasterPath.absolute?(@path)
      end
    end
  end

  private
  module Rust
    extend FFI::Library
    ffi_lib 'target/release/libfaster_path.so'
    attach_function :absolute, [ :string ], :bool
  end
  private_constant :Rust
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faster_path-0.0.1 lib/faster_path.rb