Class: Racket::Utils::FileSystem::SizedPath

Inherits:
Object
  • Object
show all
Defined in:
lib/racket/utils/file_system.rb

Overview

Class used for comparing length of paths.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject (readonly)

Returns the value of attribute path.



26
27
28
# File 'lib/racket/utils/file_system.rb', line 26

def path
  @path
end

#sizeObject (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.

Parameters:

Returns:

  • (Fixnum)


38
39
40
# File 'lib/racket/utils/file_system.rb', line 38

def <=>(other)
  other.size <=> @size
end