Class: Workbook::Template
- Inherits:
-
Object
- Object
- Workbook::Template
show all
- Includes:
- Modules::RawObjectsStorage
- Defined in:
- lib/workbook/template.rb
Instance Method Summary
(collapse)
#add_raw, #has_raw_for?, #raws, #remove_all_raws!, #return_raw_for
Constructor Details
A new instance of Template
7
8
9
10
|
# File 'lib/workbook/template.rb', line 7
def initialize
@formats = {}
@has_header = true
end
|
Instance Method Details
24
25
26
27
28
29
30
|
# File 'lib/workbook/template.rb', line 24
def add_format format
if format.is_a? Workbook::Format
@formats[format.name]=format
else
raise ArgumentError, "format should be a Workboot::Format"
end
end
|
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/workbook/template.rb', line 36
def create_or_find_format_by name, variant=:default
fs = @formats[name]
fs = @formats[name] = {} if fs.nil?
f = fs[variant]
if f.nil?
f = Workbook::Format.new
if variant != :default and fs[:default]
f = fs[:default].clone
end
@formats[name][variant] = f
end
return @formats[name][variant]
end
|
32
33
34
|
# File 'lib/workbook/template.rb', line 32
def formats
@formats
end
|
16
17
18
19
20
21
22
|
# File 'lib/workbook/template.rb', line 16
def boolean
if format.is_a? TrueClass or format.is_a? FalseClass
@has_header = boolean
else
raise ArgumentError, "format should be a boolean, true of false"
end
end
|
12
13
14
|
# File 'lib/workbook/template.rb', line 12
def
@has_header
end
|