Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Pathname#size
() -> ::Integer
size → integer
pathname_builtin.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/pathname_builtin.rb, line 2618
def size() FileTest.size(@path) end
Returns the size in bytes of the entry at the path in self:
Example
Pathname('doc/maintainers.md').size # => 14900 # Regular file. Pathname('doc/syntax/').size # => 4096 # Directory.
Raises an exception if the entry does not exist.