module Mailpeek
Public: Mailpeek
Base Class
Public: Mailpeek
Constants
- VERSION
Public Class Methods
configuration()
click to toggle source
# File lib/mailpeek.rb, line 15 def self.configuration @configuration ||= Configuration.new end
configure() { |configuration| ... }
click to toggle source
# File lib/mailpeek.rb, line 19 def self.configure yield(configuration) end
email(timestamp)
click to toggle source
# File lib/mailpeek.rb, line 41 def self.email(timestamp) emails.detect { |x| x.id == timestamp } end
emails()
click to toggle source
# File lib/mailpeek.rb, line 23 def self.emails emails = [] location = Mailpeek.configuration.location prep_folder Dir.foreach(location) do |filename| next if ['.', '..'].include?(filename) path = File.join(location, filename, 'mail') email = Email.new(filename, ::Mail.read(path)) emails.push(email) end emails.sort_by(&:position).reverse end
prep_folder()
click to toggle source
# File lib/mailpeek.rb, line 60 def self.prep_folder location = Mailpeek.configuration.location FileUtils.mkdir_p(location) unless File.directory?(location) end
unread()
click to toggle source
# File lib/mailpeek.rb, line 45 def self.unread unread = 0 location = Mailpeek.configuration.location prep_folder Dir.foreach(location) do |filename| next if ['.', '..'].include?(filename) unread += 1 unless File.exist?(File.join(location, filename, '.read')) end unread end