Class: PrinceMerge
- Inherits:
-
Object
- Object
- PrinceMerge
- Defined in:
- lib/prince_merge.rb
Defined Under Namespace
Classes: Recipient
Instance Attribute Summary collapse
-
#input ⇒ Object
Returns the value of attribute input.
-
#output ⇒ Object
Returns the value of attribute output.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(input, output, template = nil) ⇒ PrinceMerge
constructor
A new instance of PrinceMerge.
- #render ⇒ Object
Constructor Details
#initialize(input, output, template = nil) ⇒ PrinceMerge
Returns a new instance of PrinceMerge.
11 12 13 14 15 |
# File 'lib/prince_merge.rb', line 11 def initialize(input, output, template = nil) @input = input @output = output @template = File.(File.dirname(__FILE__) + "/../templates/#{template || 'standard_envelope.haml'}") end |
Instance Attribute Details
#input ⇒ Object
Returns the value of attribute input.
9 10 11 |
# File 'lib/prince_merge.rb', line 9 def input @input end |
#output ⇒ Object
Returns the value of attribute output.
9 10 11 |
# File 'lib/prince_merge.rb', line 9 def output @output end |
#template ⇒ Object
Returns the value of attribute template.
9 10 11 |
# File 'lib/prince_merge.rb', line 9 def template @template end |
Instance Method Details
#html ⇒ Object
21 22 23 |
# File 'lib/prince_merge.rb', line 21 def html Haml::Engine.new(template).render(Object.new, :recipients => Recipient.load_from_csv(input)) end |
#render ⇒ Object
25 26 27 |
# File 'lib/prince_merge.rb', line 25 def render Prince.new.html_to_file(html, output) end |