Class: SipoMailer::Models::Attachment
- Inherits:
-
Object
- Object
- SipoMailer::Models::Attachment
- Defined in:
- lib/sipo_mailer/models/attachment.rb
Constant Summary collapse
- FILENAME_REGEX =
/^[0-9]+_?([0-9]{4}-[0-9]{2}-[0-9]{2})?\.[a-zA-Z0-9]+$/
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#processed_on ⇒ Object
readonly
Returns the value of attribute processed_on.
Instance Method Summary collapse
-
#initialize(filename) ⇒ Attachment
constructor
A new instance of Attachment.
- #process ⇒ Object
- #processed? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(filename) ⇒ Attachment
Returns a new instance of Attachment.
8 9 10 11 12 |
# File 'lib/sipo_mailer/models/attachment.rb', line 8 def initialize(filename) @path = filename @file = open(filename) end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'lib/sipo_mailer/models/attachment.rb', line 6 def file @file end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
6 7 8 |
# File 'lib/sipo_mailer/models/attachment.rb', line 6 def filename @filename end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/sipo_mailer/models/attachment.rb', line 6 def id @id end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/sipo_mailer/models/attachment.rb', line 6 def path @path end |
#processed_on ⇒ Object (readonly)
Returns the value of attribute processed_on.
6 7 8 |
# File 'lib/sipo_mailer/models/attachment.rb', line 6 def processed_on @processed_on end |
Instance Method Details
#process ⇒ Object
22 |
# File 'lib/sipo_mailer/models/attachment.rb', line 22 def process; end |
#processed? ⇒ Boolean
18 19 20 |
# File 'lib/sipo_mailer/models/attachment.rb', line 18 def processed? !@processed_on.nil? end |
#valid? ⇒ Boolean
14 15 16 |
# File 'lib/sipo_mailer/models/attachment.rb', line 14 def valid? !(@filename =~ FILENAME_REGEX).nil? end |