Class: Glark::Depth
- Inherits:
-
Object
- Object
- Glark::Depth
- Defined in:
- lib/glark/util/io/depth.rb
Overview
Depth for recursing directories.
Constant Summary collapse
- INFINITY =
:infinity
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #-(num) ⇒ Object
- #infinity? ⇒ Boolean
-
#initialize(value) ⇒ Depth
constructor
A new instance of Depth.
- #nonzero? ⇒ Boolean
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
#value ⇒ Object (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
16 17 18 |
# File 'lib/glark/util/io/depth.rb', line 16 def infinity? @value == INFINITY end |
#nonzero? ⇒ Boolean
25 26 27 |
# File 'lib/glark/util/io/depth.rb', line 25 def nonzero? infinity? || @value.nil? || @value >= 0 end |