Module: FasterPath
- Defined in:
- lib/faster_path.rb,
lib/faster_path/version.rb,
lib/faster_path/optional/refinements.rb,
lib/faster_path/optional/monkeypatches.rb
Overview
:nodoc:
Defined Under Namespace
Modules: RefineFile, RefinePathname
Constant Summary collapse
- FFI_LIBRARY =
begin toplevel_dir = File.dirname(__dir__) config = Thermite::Config.new(cargo_project_path: toplevel_dir, ruby_project_path: toplevel_dir) config.ruby_extension_path end
- VERSION =
"0.3.9"
Class Method Summary collapse
-
.basename(pth, ext = "") ⇒ String
Rust implementation of File.basename.
-
.blank?(str) ⇒ true, false
A very fast way to check if a string is blank.
-
.children(pth, with_directory = true) ⇒ Array<String>
Rust implementation of Pathname.children.
-
.children_compat(pth, with_directory = true) ⇒ Array<Pathname>
Rust implementation of Pathname.children.
-
.ruby_arch_bits ⇒ Integer
The Ruby architecture bit width: 64bits or 32bits.
-
.rust_arch_bits ⇒ Integer
The Rust architecture bit width: 64bits or 32bits.
-
.sledgehammer_everything! ⇒ Object
Applies all performant monkeypatches to both ‘Pathname` and `File`.
Class Method Details
.basename(pth, ext = "") ⇒ String
Rust implementation of File.basename
52 53 54 |
# File 'lib/faster_path.rb', line 52 def self.basename(pth, ext="") Public.send(:basename, pth, ext) end |
.blank?(str) ⇒ true, false
A very fast way to check if a string is blank
44 45 46 |
# File 'lib/faster_path.rb', line 44 def self.blank?(str) "#{str}".strip.empty? end |
.children(pth, with_directory = true) ⇒ Array<String>
Rust implementation of Pathname.children
60 61 62 |
# File 'lib/faster_path.rb', line 60 def self.children(pth, with_directory=true) Public.send(:children, pth, with_directory) end |
.children_compat(pth, with_directory = true) ⇒ Array<Pathname>
Rust implementation of Pathname.children
68 69 70 |
# File 'lib/faster_path.rb', line 68 def self.children_compat(pth, with_directory=true) Public.send(:children_compat, pth, with_directory) end |
.ruby_arch_bits ⇒ Integer
The Ruby architecture bit width: 64bits or 32bits
37 38 39 |
# File 'lib/faster_path.rb', line 37 def self.ruby_arch_bits 1.size * 8 end |
.rust_arch_bits ⇒ Integer
The Rust architecture bit width: 64bits or 32bits
31 32 33 |
# File 'lib/faster_path.rb', line 31 def self.rust_arch_bits Rust.rust_arch_bits end |
.sledgehammer_everything! ⇒ Object
Applies all performant monkeypatches to both ‘Pathname` and `File`
121 122 123 124 |
# File 'lib/faster_path/optional/monkeypatches.rb', line 121 def self.sledgehammer_everything! MonkeyPatches._ruby_core_file! MonkeyPatches._ruby_library_pathname! end |