Class: PopThis::POP3Server::Email
- Inherits:
-
Object
- Object
- PopThis::POP3Server::Email
- Defined in:
- lib/pop_this.rb
Instance Attribute Summary collapse
-
#deleted ⇒ Object
Returns the value of attribute deleted.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Class Method Summary collapse
Instance Method Summary collapse
- #deleted? ⇒ Boolean
- #email ⇒ Object
-
#initialize(filename) ⇒ Email
constructor
A new instance of Email.
Constructor Details
#initialize(filename) ⇒ Email
Returns a new instance of Email.
24 25 26 27 |
# File 'lib/pop_this.rb', line 24 def initialize(filename) @filename = filename @deleted = false end |
Instance Attribute Details
#deleted ⇒ Object
Returns the value of attribute deleted.
14 15 16 |
# File 'lib/pop_this.rb', line 14 def deleted @deleted end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
13 14 15 |
# File 'lib/pop_this.rb', line 13 def filename @filename end |
Class Method Details
.all(dir) ⇒ Object
16 17 18 |
# File 'lib/pop_this.rb', line 16 def self.all(dir) Dir.glob("#{ dir }/*").reject{|fn| fn =~ /^\./ || File.directory?(fn) }.map{|fn| Email.new(fn) } end |
.delete(email) ⇒ Object
20 21 22 |
# File 'lib/pop_this.rb', line 20 def self.delete(email) File.delete(email.filename) end |
Instance Method Details
#deleted? ⇒ Boolean
33 34 35 |
# File 'lib/pop_this.rb', line 33 def deleted? deleted end |
#email ⇒ Object
29 30 31 |
# File 'lib/pop_this.rb', line 29 def email @email ||= File.read(@filename) end |