Class: Condom::Letter
Overview
The Letter class. This class is used to produce a letter.
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#recipient ⇒ Object
Returns the value of attribute recipient.
-
#recipient_address ⇒ Object
Returns the value of attribute recipient_address.
Attributes inherited from Base
#author, #date, #directory, #document_class, #filename, #language, #other_packages, #title
Instance Method Summary collapse
-
#create ⇒ Object
This method will write in the output directory all needed files.
-
#initialize(args = nil) ⇒ Letter
constructor
The constructor.
Methods inherited from Base
Constructor Details
#initialize(args = nil) ⇒ Letter
The constructor. Argument could be:
-
nothing,
-
the title of the document,
-
a hash of options.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/condom/letter.rb', line 13 def initialize(args = nil) # Need to initialize each variables else they won't exist in instance_variables. @address = @recipient = @recipient_address = nil # The default options = { :document_class => 'letter', :title => 'Lettre \LaTeX', :filename => 'letter', :address => '', :recipient => 'Mr John Smith', :recipient_address => '' } if args.is_a? String [:title] = args elsif args.is_a? Hash .merge! args end super() end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
6 7 8 |
# File 'lib/condom/letter.rb', line 6 def address @address end |
#recipient ⇒ Object
Returns the value of attribute recipient.
6 7 8 |
# File 'lib/condom/letter.rb', line 6 def recipient @recipient end |
#recipient_address ⇒ Object
Returns the value of attribute recipient_address.
6 7 8 |
# File 'lib/condom/letter.rb', line 6 def recipient_address @recipient_address end |
Instance Method Details
#create ⇒ Object
This method will write in the output directory all needed files.
37 38 39 40 41 42 43 44 |
# File 'lib/condom/letter.rb', line 37 def create in_directory do # Create files build "letter.tex" File.rename("letter.tex", "main.tex") build "Makefile" end end |