Module: PdfInvoice

Defined in:
lib/pdfinvoice/config.rb,
lib/pdfinvoice/invoice.rb

Defined Under Namespace

Classes: Invoice

Class Method Summary collapse

Class Method Details

.config(argv = []) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/pdfinvoice/config.rb', line 7

def PdfInvoice.config(argv=[])
	default_dir = File.join(Dir.home, '.pdfinvoice')
	default_config_files = [
		File.join(default_dir, 'config.yml'),
		'/etc/pdfinvoice/config.yml',
	]
	defaults = {
		'colors'						=> {
			'items'						=> [0xFA, 0xFA, 0xFA],	
			'total'						=> [0xF0, 0xF0, 0xF0],	
		},
		'config'						=> default_config_files,
		'creditor_address'	=> "Please set creditor_address etc in: #{default_config_files}",
		'creditor_email'		=> '',
		'creditor_bank'			=> '',
		'due_days'					=> '',
		'font'							=> 'Helvetica',
		'font_b'						=> 'Helvetica-Bold',
		'formats'						=> {
			'currency'				=> "%1.2f",
			'total'						=> "%1.2f",
			'date'						=> "%d.%m.%Y",
			'invoice_number'	=> "<b>#%06i</b>",
			'quantity'				=> '%1.1f',
		},
		'logo_path'					=> nil,
		'logo_link'					=> nil,
		'tax'								=> 0,
		'texts'							=> {
			'date'						=> 'Date',	
			'description'			=> 'Description',
			'unit'						=> 'Unit',
			'quantity'				=> 'Quantity',
			'price'						=> 'Price',
			'item_total'			=> 'Item Total',
			'subtotal'				=> 'Subtotal',
			'tax'							=> 'Tax',
			'thanks'					=> nil,
			'total'						=> 'Total',
		},
		'text_options'			=> {:spacing => 1.25},
	}
	config = RCLConf::RCLConf.new(ARGV, defaults)
	config.load(config.config)
	config
end