Class: Pathname
- Inherits:
-
Object
- Object
- Pathname
- Defined in:
- lib/bytesize.rb
Overview
ByteSize adds two new methods to the Pathname class:
-
#bytesize
-
#bytesize?
Plus the equivalent methods for IECByteSize:
-
#iecbytesize
-
#iecbytesize?
Instance Method Summary collapse
-
#bytesize ⇒ Object
:call-seq: bytesize -> bytesize.
-
#bytesize? ⇒ Boolean
:call-seq: bytesize? -> bytesize or nil.
-
#iecbytesize ⇒ Object
:call-seq: iecbytesize -> bytesize.
-
#iecbytesize? ⇒ Boolean
:call-seq: iecbytesize? -> bytesize or nil.
Instance Method Details
#bytesize ⇒ Object
:call-seq:
bytesize -> bytesize
Identical to #size[https://ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html#method-i-size] except that the value is returned as an instance of ByteSize.
1238 1239 1240 |
# File 'lib/bytesize.rb', line 1238 def bytesize ByteSize.new(size) end |
#bytesize? ⇒ Boolean
:call-seq:
bytesize? -> bytesize or nil
Identical to #size?[https://ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html#method-i-size-3F] except that the value is returned as an instance of ByteSize.
1251 1252 1253 1254 |
# File 'lib/bytesize.rb', line 1251 def bytesize? sz = size? sz.nil? ? nil : ByteSize.new(sz) end |
#iecbytesize ⇒ Object
:call-seq:
iecbytesize -> bytesize
Identical to #size[https://ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html#method-i-size] except that the value is returned as an instance of IECByteSize.
1265 1266 1267 |
# File 'lib/bytesize.rb', line 1265 def iecbytesize IECByteSize.new(size) end |
#iecbytesize? ⇒ Boolean
:call-seq:
iecbytesize? -> bytesize or nil
Identical to #size?[https://ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html#method-i-size-3F] except that the value is returned as an instance of IECByteSize.
1278 1279 1280 1281 |
# File 'lib/bytesize.rb', line 1278 def iecbytesize? sz = size? sz.nil? ? nil : IECByteSize.new(sz) end |