Class: Java::ComPff::PSTFolder

Inherits:
Object
  • Object
show all
Defined in:
lib/pst/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fileObject

Returns the value of attribute file.



25
26
27
# File 'lib/pst/base.rb', line 25

def file
  @file
end

#parentObject

Returns the value of attribute parent.



26
27
28
# File 'lib/pst/base.rb', line 26

def parent
  @parent
end

Instance Method Details

#childrenObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 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
  #
  # 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_timeObject



94
95
96
97
# File 'lib/pst/base.rb', line 94

def creation_time
  t = self.getCreationTime || self.getLastModificationTime
  t.andand.to_time
end

#filenameObject



67
68
69
# File 'lib/pst/base.rb', line 67

def filename 
  self.file.filename
end

#hash_stringObject



85
86
87
# File 'lib/pst/base.rb', line 85

def hash_string
  Digest::SHA1.hexdigest(human_id)
end

#human_idObject



81
82
83
# File 'lib/pst/base.rb', line 81

def human_id
  "%s:%s:%s" % [self.file.collection || "no-collection", filename, path]
end

#nameObject



30
31
32
# File 'lib/pst/base.rb', line 30

def name
  self.getDisplayName
end

#pathObject



71
72
73
74
75
76
77
78
79
# File 'lib/pst/base.rb', line 71

def path
  levels = [self.name]
  f = self
  while p = f.parent
    levels << p.name
    f = p
  end
  levels.reverse.join("/")
end

#sub_foldersObject



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