Class: Ole::Storage::DirClass::Dir
- Inherits:
-
Object
- Object
- Ole::Storage::DirClass::Dir
- Includes:
- Enumerable
- Defined in:
- lib/ole/file_system.rb
Overview
note that there is nothing remotely ole specific about this class. it simply provides the dir like sequential access methods on top of an array. hmm, doesn’t throw the IOError’s on use of a closed directory…
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#pos ⇒ Object
(also: #tell)
Returns the value of attribute pos.
Instance Method Summary collapse
- #close ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(path, entries) ⇒ Dir
constructor
A new instance of Dir.
- #read ⇒ Object
- #rewind ⇒ Object
Methods included from Enumerable
Constructor Details
#initialize(path, entries) ⇒ Dir
Returns a new instance of Dir.
393 394 395 |
# File 'lib/ole/file_system.rb', line 393 def initialize path, entries @path, @entries, @pos = path, entries, 0 end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
392 393 394 |
# File 'lib/ole/file_system.rb', line 392 def entries @entries end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
392 393 394 |
# File 'lib/ole/file_system.rb', line 392 def path @path end |
#pos ⇒ Object Also known as: tell
Returns the value of attribute pos.
392 393 394 |
# File 'lib/ole/file_system.rb', line 392 def pos @pos end |
Instance Method Details
#close ⇒ Object
401 402 |
# File 'lib/ole/file_system.rb', line 401 def close end |
#each(&block) ⇒ Object
397 398 399 |
# File 'lib/ole/file_system.rb', line 397 def each(&block) entries.each(&block) end |
#read ⇒ Object
404 405 406 407 408 |
# File 'lib/ole/file_system.rb', line 404 def read entries[pos] ensure @pos += 1 if pos < entries.length end |
#rewind ⇒ Object
414 415 416 |
# File 'lib/ole/file_system.rb', line 414 def rewind @pos = 0 end |