Class: Racket::Utils::FileSystem::SizedPath
- Inherits:
-
Object
- Object
- Racket::Utils::FileSystem::SizedPath
- Defined in:
- lib/racket/utils/file_system.rb
Overview
Class used for comparing length of paths.
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
-
#<=>(other) ⇒ Fixnum
Allow us to compare the current object against other objects of the same type.
-
#initialize(path) ⇒ SizedPath
constructor
A new instance of SizedPath.
Constructor Details
#initialize(path) ⇒ SizedPath
Returns a new instance of SizedPath.
28 29 30 31 32 |
# File 'lib/racket/utils/file_system.rb', line 28 def initialize(path) @path = path @size = 0 @path.ascend { @size += 1 } end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
26 27 28 |
# File 'lib/racket/utils/file_system.rb', line 26 def path @path end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
26 27 28 |
# File 'lib/racket/utils/file_system.rb', line 26 def size @size end |
Instance Method Details
#<=>(other) ⇒ Fixnum
Allow us to compare the current object against other objects of the same type.
38 39 40 |
# File 'lib/racket/utils/file_system.rb', line 38 def <=>(other) other.size <=> @size end |