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.10"
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
57 58 59 |
# File 'lib/faster_path.rb', line 57 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
49 50 51 |
# File 'lib/faster_path.rb', line 49 def self.blank?(str) "#{str}".strip.empty? end |
.children(pth, with_directory = true) ⇒ Array<String>
Rust implementation of Pathname.children
65 66 67 |
# File 'lib/faster_path.rb', line 65 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
73 74 75 |
# File 'lib/faster_path.rb', line 73 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
42 43 44 |
# File 'lib/faster_path.rb', line 42 def self.ruby_arch_bits 1.size * 8 end |
.rust_arch_bits ⇒ Integer
The Rust architecture bit width: 64bits or 32bits
36 37 38 |
# File 'lib/faster_path.rb', line 36 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 |