Class: TemplateMessage
- Inherits:
-
Object
- Object
- TemplateMessage
- Defined in:
- lib/metro/template_message.rb
Defined Under Namespace
Classes: Message
Instance Method Summary collapse
- #email ⇒ Object
-
#initialize(details = {}) ⇒ TemplateMessage
constructor
A new instance of TemplateMessage.
- #message_filename ⇒ Object
- #message_template ⇒ Object
- #messages ⇒ Object
- #to_s ⇒ Object
- #website ⇒ Object
Constructor Details
#initialize(details = {}) ⇒ TemplateMessage
Returns a new instance of TemplateMessage.
3 4 5 6 7 8 |
# File 'lib/metro/template_message.rb', line 3 def initialize(details = {}) @messages = Array(details[:message]) + Array(details[:messages]) @details = details[:details] @website = details[:website] @email = details[:contact] end |
Instance Method Details
#email ⇒ Object
44 45 46 |
# File 'lib/metro/template_message.rb', line 44 def email Array(@email).map {|email| "* #{email}" }.join("\n") end |
#message_filename ⇒ Object
48 49 50 |
# File 'lib/metro/template_message.rb', line 48 def File.join(File.dirname(__FILE__),"..","templates","message.erb") end |
#message_template ⇒ Object
52 53 54 |
# File 'lib/metro/template_message.rb', line 52 def File.read() end |
#messages ⇒ Object
36 37 38 |
# File 'lib/metro/template_message.rb', line 36 def @messages.map {|m| Message.new m, @details } end |
#to_s ⇒ Object
56 57 58 |
# File 'lib/metro/template_message.rb', line 56 def to_s ERB.new().result(binding) end |
#website ⇒ Object
40 41 42 |
# File 'lib/metro/template_message.rb', line 40 def website Array(@website).map {|website| "* #{website}" }.join("\n") end |