Class: EmailDoc::Document
- Inherits:
-
Object
- Object
- EmailDoc::Document
- Extended by:
- Forwardable
- Defined in:
- lib/email_doc/document.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#ex ⇒ Object
readonly
Returns the value of attribute ex.
-
#mail ⇒ Object
readonly
Returns the value of attribute mail.
Instance Method Summary collapse
-
#initialize(context, mail, ex) ⇒ Document
constructor
A new instance of Document.
- #pathname ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(context, mail, ex) ⇒ Document
Returns a new instance of Document.
13 14 15 16 17 |
# File 'lib/email_doc/document.rb', line 13 def initialize(context, mail, ex) @context = context @mail = mail @ex = ex end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
8 9 10 |
# File 'lib/email_doc/document.rb', line 8 def context @context end |
#ex ⇒ Object (readonly)
Returns the value of attribute ex.
8 9 10 |
# File 'lib/email_doc/document.rb', line 8 def ex @ex end |
#mail ⇒ Object (readonly)
Returns the value of attribute mail.
8 9 10 |
# File 'lib/email_doc/document.rb', line 8 def mail @mail end |
Instance Method Details
#pathname ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/email_doc/document.rb', line 38 def pathname @pathname ||= begin dir = './doc/mail/' path = ex.file_path.gsub(%r<\./spec/mailers/(.+)_spec\.rb>, '\1.md') Pathname.new(dir + path) end end |
#render ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/email_doc/document.rb', line 19 def render ERB.new(<<-MD_END).result(binding) # #{described_class} ## #{ex.description} ``` From: #{from} Subject: #{subject} To: #{to} Reply to: #{reply_to} ``` ``` #{body.encoded} ``` MD_END end |