Class: XLSSestavy::Sestava
Constant Summary
collapse
- NAZEV =
'Prázdná sestava'
Instance Attribute Summary collapse
Instance Method Summary
collapse
#add_altered_format, #add_default_format, #add_format, #alter_format, #get_format, #set_aktivni_format
#sestava_cas_vytvoreni, #sestava_nadpis, #sestava_napdis2, #vypis_souctovy_radek, #vypis_tabulku, #vytvor_list, #zapis, #zapis_radu, #zapis_sloupec
Constructor Details
#initialize(args = {}) ⇒ Sestava
Returns a new instance of Sestava.
16
17
18
19
|
# File 'lib/xls_sestavy/sestava.rb', line 16
def initialize(args={})
args[:k_datu] = Date.today unless args[:k_datu]
@argumenty = ArgumentySestavy.new args
end
|
Instance Attribute Details
#argumenty ⇒ Object
Returns the value of attribute argumenty.
14
15
16
|
# File 'lib/xls_sestavy/sestava.rb', line 14
def argumenty
@argumenty
end
|
Instance Method Details
#nazev_souboru ⇒ Object
33
34
35
|
# File 'lib/xls_sestavy/sestava.rb', line 33
def nazev_souboru
to_s + '.xls'
end
|
#po_vypracovani(f) ⇒ Object
31
|
# File 'lib/xls_sestavy/sestava.rb', line 31
def po_vypracovani(f); end
|
#to_s ⇒ Object
37
38
39
|
# File 'lib/xls_sestavy/sestava.rb', line 37
def to_s
"#{self.class::NAZEV.gsub(' ','_')}_#{@argumenty.to_s}"
end
|
#vypracuj_sestavu ⇒ Object
29
|
# File 'lib/xls_sestavy/sestava.rb', line 29
def vypracuj_sestavu; end
|
#vytvor_soubor ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/xls_sestavy/sestava.rb', line 21
def vytvor_soubor
f = Tempfile.new self.class::NAZEV.gsub(' ','_'), Rails.root.join('tmp')
@wb = ::WriteExcel.new f
vypracuj_sestavu
@wb.close
block_given? ? yield(f) : po_vypracovani(f)
end
|