Class: Rmsgen::Polnote
- Inherits:
-
Object
- Object
- Rmsgen::Polnote
- Defined in:
- lib/rmsgen/polnote.rb
Constant Summary collapse
- URGENT_SUBJECT =
'Subject: Urgent note'
- TEMPLATE =
File.join(File.dirname(__FILE__), '..', 'templates', 'polnote.erb')
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#expires_on ⇒ Object
Returns the value of attribute expires_on.
-
#id ⇒ Object
Returns the value of attribute id.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(source, options = {}) ⇒ Polnote
constructor
A new instance of Polnote.
- #inquire ⇒ Object
- #parts ⇒ Object
- #titleize ⇒ Object
- #to_html ⇒ Object
- #urgent? ⇒ Boolean
Constructor Details
#initialize(source, options = {}) ⇒ Polnote
Returns a new instance of Polnote.
8 9 10 11 12 13 |
# File 'lib/rmsgen/polnote.rb', line 8 def initialize(source, ={}) @body = source.dup @urgent = source.include? URGENT_SUBJECT @id = [:id] compress! end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/rmsgen/polnote.rb', line 3 def body @body end |
#expires_on ⇒ Object
Returns the value of attribute expires_on.
3 4 5 |
# File 'lib/rmsgen/polnote.rb', line 3 def expires_on @expires_on end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/rmsgen/polnote.rb', line 3 def id @id end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/rmsgen/polnote.rb', line 3 def title @title end |
Instance Method Details
#inquire ⇒ Object
23 24 25 |
# File 'lib/rmsgen/polnote.rb', line 23 def inquire @body = Inquirer.new(self).body end |
#parts ⇒ Object
27 28 29 |
# File 'lib/rmsgen/polnote.rb', line 27 def parts PartGroup.new(@body) end |
#titleize ⇒ Object
19 20 21 |
# File 'lib/rmsgen/polnote.rb', line 19 def titleize @title = Titleizer.new(self).body end |
#to_html ⇒ Object
31 32 33 |
# File 'lib/rmsgen/polnote.rb', line 31 def to_html ERB.new(File.read(TEMPLATE)).result(binding) end |
#urgent? ⇒ Boolean
15 16 17 |
# File 'lib/rmsgen/polnote.rb', line 15 def urgent? @urgent end |