class Hermes::Box
Mailboxes
Attributes
boxes[R]
Public Class Methods
new( path) → box
click to toggle source
Instantiate a Box object, just store the
path
.
# File lib/hermes/boxes.rb, line 76 def initialize mailbox @mailbox = mailbox end
Public Instance Methods
check( path) → nil
click to toggle source
By default, subclass mailboxes do not exist. You should overwrite this behaviour.
# File lib/hermes/boxes.rb, line 60 def check path end
exists? → true or false
click to toggle source
Test whether the Box
exists.
# File lib/hermes/boxes.rb, line 89 def exists? self.class.check @mailbox end
find( path, default = nil) → box
click to toggle source
Create a Box object (some subclass of Box), depending on what type the box is found at
path
.
# File lib/hermes/boxes.rb, line 40 def find path, default_format = nil b = @boxes.find { |b| b.check path } b ||= default_format b ||= if File.directory? path then Maildir elsif File.file? path then MBox else # If still nothing was found use Postfix convention: path =~ /\/$/ ? Maildir : MBox end b.new path end
path()
click to toggle source
# File lib/hermes/boxes.rb, line 82 def path ; @mailbox ; end
to_s()
click to toggle source
# File lib/hermes/boxes.rb, line 80 def to_s ; path ; end
Protected Instance Methods
inherited(cls)
click to toggle source
# File lib/hermes/boxes.rb, line 65 def inherited cls Box.boxes.push cls end