Class: Glark::Depth

Inherits:
Object
  • Object
show all
Defined in:
lib/glark/util/io/depth.rb

Overview

Depth for recursing directories.

Constant Summary collapse

INFINITY =
:infinity

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Depth

Returns a new instance of Depth.



12
13
14
# File 'lib/glark/util/io/depth.rb', line 12

def initialize value
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10
11
12
# File 'lib/glark/util/io/depth.rb', line 10

def value
  @value
end

Instance Method Details

#-(num) ⇒ Object



20
21
22
23
# File 'lib/glark/util/io/depth.rb', line 20

def - num
  return self if infinity? || @value.nil?
  self.class.new @value - 1
end

#infinity?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/glark/util/io/depth.rb', line 16

def infinity?
  @value == INFINITY
end

#nonzero?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/glark/util/io/depth.rb', line 25

def nonzero?
  infinity? || @value.nil? || @value >= 0
end