Class: Condom::Classic
Overview
The Classic class. This class is used to produce a classic document such as an article, a report or a book.
Instance Attribute Summary collapse
-
#fancyhdr ⇒ Object
Returns the value of attribute fancyhdr.
-
#graphics ⇒ Object
Returns the value of attribute graphics.
-
#listings ⇒ Object
Returns the value of attribute listings.
-
#math ⇒ Object
Returns the value of attribute math.
-
#pdf ⇒ Object
Returns the value of attribute pdf.
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) ⇒ Classic
constructor
The constructor.
Methods inherited from Base
Constructor Details
#initialize(args = nil) ⇒ Classic
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/classic.rb', line 13 def initialize(args = nil) # Need to initialize each variables else they won't exist in instance_variables. @listings = @fancyhdr = @graphics = @math = @pdf = nil # The default options = { :filename => 'document', :listings => false, :fancyhdr => false, :graphics => false, :math => false, :pdf => true } if args.is_a? String [:title] = args elsif args.is_a? Hash .merge! args end super() end |
Instance Attribute Details
#fancyhdr ⇒ Object
Returns the value of attribute fancyhdr.
6 7 8 |
# File 'lib/condom/classic.rb', line 6 def fancyhdr @fancyhdr end |
#graphics ⇒ Object
Returns the value of attribute graphics.
6 7 8 |
# File 'lib/condom/classic.rb', line 6 def graphics @graphics end |
#listings ⇒ Object
Returns the value of attribute listings.
6 7 8 |
# File 'lib/condom/classic.rb', line 6 def listings @listings end |
#math ⇒ Object
Returns the value of attribute math.
6 7 8 |
# File 'lib/condom/classic.rb', line 6 def math @math end |
#pdf ⇒ Object
Returns the value of attribute pdf.
6 7 8 |
# File 'lib/condom/classic.rb', line 6 def pdf @pdf 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 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/condom/classic.rb', line 37 def create in_directory do # Create files build "classic.tex" File.rename("classic.tex", "main.tex") build "Makefile" if @graphics build "fig.tex" Dir.mkdir "fig" end Dir.mkdir "src" if @listings Dir.mkdir "inc" Dir.chdir "inc" do build "packages.tex" build "commands.tex" build "colors.tex" build "listings.tex" if @listings build "first-page.tex" if @document_class == "report" end end end |