Class: Rmsgen::Polnote

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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, options={})
  @body   = source.dup
  @urgent = source.include? URGENT_SUBJECT
  @id     = options[:id]
  compress!
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/rmsgen/polnote.rb', line 3

def body
  @body
end

#expires_onObject

Returns the value of attribute expires_on.



3
4
5
# File 'lib/rmsgen/polnote.rb', line 3

def expires_on
  @expires_on
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/rmsgen/polnote.rb', line 3

def id
  @id
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/rmsgen/polnote.rb', line 3

def title
  @title
end

Instance Method Details

#inquireObject



23
24
25
# File 'lib/rmsgen/polnote.rb', line 23

def inquire
  @body = Inquirer.new(self).body
end

#partsObject



27
28
29
# File 'lib/rmsgen/polnote.rb', line 27

def parts
  PartGroup.new(@body)
end

#titleizeObject



19
20
21
# File 'lib/rmsgen/polnote.rb', line 19

def titleize
  @title = Titleizer.new(self).body
end

#to_htmlObject



31
32
33
# File 'lib/rmsgen/polnote.rb', line 31

def to_html
  ERB.new(File.read(TEMPLATE)).result(binding)
end

#urgent?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rmsgen/polnote.rb', line 15

def urgent?
  @urgent
end