Module: FasterPath

Defined in:
lib/faster_path/asset_resolution.rb,
lib/faster_path.rb,
lib/faster_path/version.rb,
lib/faster_path/optional/refinements.rb,
lib/faster_path/optional/monkeypatches.rb

Overview

This is a redundancy check for the rust compiled library needed for this gem. If the asset is not available and we can’t compile it from this code then FAIL on require of ‘faster_path’ with a very clear message as to why.“

Defined Under Namespace

Modules: AssetResolution, RefineFile, RefinePathname

Constant Summary collapse

FFI_LIBRARY =
begin
  prefix = Gem.win_platform? ? "" : "lib"
  "#{File.expand_path("../target/release/", __dir__)}/#{prefix}faster_path.#{FFI::Platform::LIBSUFFIX}"
end
VERSION =
"0.2.1"

Class Method Summary collapse

Class Method Details

.absolute?(pth) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/faster_path.rb', line 60

def self.absolute?(pth)
  FasterPathname::Public.allocate.send(:absolute?, pth)
end

.add_trailing_separator(pth) ⇒ Object



64
65
66
# File 'lib/faster_path.rb', line 64

def self.add_trailing_separator(pth)
  FasterPathname::Public.allocate.send(:add_trailing_separator, pth)
end

.basename(pth, ext = "") ⇒ Object



72
73
74
# File 'lib/faster_path.rb', line 72

def self.basename(pth, ext="")
  FasterPathname::Public.allocate.send(:basename, pth, ext)
end

.blank?(str) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/faster_path.rb', line 68

def self.blank?(str)
  "#{str}".strip.empty?
end

.children(pth, with_directory = true) ⇒ Object



76
77
78
# File 'lib/faster_path.rb', line 76

def self.children(pth, with_directory=true)
  FasterPathname::Public.allocate.send(:children, pth, with_directory)
end

.chop_basename(pth) ⇒ Object



80
81
82
83
# File 'lib/faster_path.rb', line 80

def self.chop_basename(pth)
  result = FasterPathname::Public.allocate.send(:chop_basename, pth)
  result unless result.empty?
end

.directory?(pth) ⇒ Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/faster_path.rb', line 85

def self.directory?(pth)
  FasterPathname::Public.allocate.send(:directory?, pth)
end

.dirname(pth) ⇒ Object



89
90
91
# File 'lib/faster_path.rb', line 89

def self.dirname(pth)
  FasterPathname::Public.allocate.send(:dirname, pth)
end

.entries(pth) ⇒ Object



93
94
95
# File 'lib/faster_path.rb', line 93

def self.entries(pth)
  FasterPathname::Public.allocate.send(:entries, pth)
end

.extname(pth) ⇒ Object



97
98
99
# File 'lib/faster_path.rb', line 97

def self.extname(pth)
  FasterPathname::Public.allocate.send(:extname, pth)
end

.has_trailing_separator?(pth) ⇒ Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/faster_path.rb', line 101

def self.has_trailing_separator?(pth)
  FasterPathname::Public.allocate.send(:has_trailing_separator?, pth)
end

.plus(pth, pth2) ⇒ Object



105
106
107
# File 'lib/faster_path.rb', line 105

def self.plus(pth, pth2)
  FasterPathname::Public.allocate.send(:plus, pth, pth2)
end

.relative?(pth) ⇒ Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/faster_path.rb', line 109

def self.relative?(pth)
  FasterPathname::Public.allocate.send(:relative?, pth)
end

.ruby_arch_bitsObject



56
57
58
# File 'lib/faster_path.rb', line 56

def self.ruby_arch_bits
  1.size * 8
end

.rust_arch_bitsObject



52
53
54
# File 'lib/faster_path.rb', line 52

def self.rust_arch_bits
  Rust.rust_arch_bits
end

.sledgehammer_everything!(include_file = !!ENV['WITH_REGRESSION'])) ⇒ Object



76
77
78
79
80
# File 'lib/faster_path/optional/monkeypatches.rb', line 76

def self.sledgehammer_everything!(include_file = !!ENV['WITH_REGRESSION'])
  MonkeyPatches._ruby_core_file! if include_file # SLOW; DON'T AUTO INCLUDE
  MonkeyPatches._ruby_library_pathname!
  "CAUTION: Monkey patching effects everything! Be very sure you want this!"
end