Class: Java::ComPff::PSTFolder
- Inherits:
-
Object
- Object
- Java::ComPff::PSTFolder
- Defined in:
- lib/pst/base.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #children ⇒ Object
- #creation_trme ⇒ Object
- #filename ⇒ Object
- #hash_string ⇒ Object
- #human_id ⇒ Object
- #name ⇒ Object
- #path ⇒ Object
- #sub_folders ⇒ Object
-
#take(n) ⇒ Object
TODO this might suffer from the same problem as #children.
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
25 26 27 |
# File 'lib/pst/base.rb', line 25 def file @file end |
#parent ⇒ Object
Returns the value of attribute parent.
26 27 28 |
# File 'lib/pst/base.rb', line 26 def parent @parent end |
Instance Method Details
#children ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/pst/base.rb', line 46 def children # this doesn't work dont use it. it doesn't work because # Enumerator does some sort of non-deterministic lookaheads # that move the cursor out from underneith the underlying # java-pst library # # instead do: # # while pe = pst_folder.getNextChild # # ... use pe # end # # Maybe once I understand Enumerator better we can fix this. raise "TODO" Enumerator.new do |yielder| max = self.email_count idx = 0 while idx < max self.moveChildCursorTo(idx) kid = self.getNextChild kid.folder = self yielder.yield kid idx = idx + 1 end end end |
#creation_trme ⇒ Object
112 113 114 115 |
# File 'lib/pst/base.rb', line 112 def creation_trme t = self.getCreationTime || self.getLastModificationTime t.andand.to_time end |
#filename ⇒ Object
85 86 87 |
# File 'lib/pst/base.rb', line 85 def filename self.file.filename end |
#hash_string ⇒ Object
103 104 105 |
# File 'lib/pst/base.rb', line 103 def hash_string Digest::SHA1.hexdigest(human_id) end |
#human_id ⇒ Object
99 100 101 |
# File 'lib/pst/base.rb', line 99 def human_id "%s:%s:%s" % [self.file.collection || "no-collection", filename, path] end |
#name ⇒ Object
30 31 32 |
# File 'lib/pst/base.rb', line 30 def name self.getDisplayName end |
#path ⇒ Object
89 90 91 92 93 94 95 96 97 |
# File 'lib/pst/base.rb', line 89 def path levels = [self.name] f = self while p = f.parent levels << p.name f = p end levels.reverse.join("/") end |
#sub_folders ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/pst/base.rb', line 34 def sub_folders Enumerator.new do |yielder| self.getSubFolders.each do |f| f.parent = self yielder.yield f f.sub_folders.each do |fc| yielder.yield fc end end end end |
#take(n) ⇒ Object
TODO this might suffer from the same problem as #children.
74 75 76 77 78 79 80 81 82 |
# File 'lib/pst/base.rb', line 74 def take(n) i = 0 results = [] while i < n && pe = self.getNextChild results << pe i = i + 1 end results end |