xls_sestavy 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTEwYTU4ZDdjMDEwMzYxMWNhOTdmMjdiOTE2NjhkOGFlYzBiYjY5NA==
5
+ data.tar.gz: !binary |-
6
+ ZGQ3YWFjZjc0ZDFhYmQ4NDFkODI1OTkyMThkN2UzNGI2Y2RmMjhjZg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OWM4ZGY5MTNiN2FhZjAzOTJjYzVhYjFlNTMyZGEzZjA1NGNlZDNkOWQwZjBh
10
+ ZDhiOGJiNjFhMGVlYTE1YzVkMWRlZTVjZTRhYjYyMWRmMGY0ZTIyYzk5MjY0
11
+ ZGU2ZWQyZDlmYWY2OWRjYWUyYmNhNGZmZTcyODQ1OGZiNzc2Njg=
12
+ data.tar.gz: !binary |-
13
+ ZTZkY2U0OTllMWU1NzlhYjE4YmQ1MjRhN2UxMjdlYTNiZmQwYTIyYmE3ZGJi
14
+ MDNkY2VlZWIzNWZjMzA2NDVkYzViMjZiZWRmYjliZmI5YTA1MTc3ZGZjNTE5
15
+ NGQ2NjZhZDkxY2ZjNDYzY2E3NTI2MjM0MzliMjJjODgxOTEzOTc=
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in xls_sestavy.gemspec
4
+ gemspec
5
+
6
+ gem 'writeexcel'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ondřej Želazko
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # XlsSestavy
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'xls_sestavy'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install xls_sestavy
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+ module XLSSestavy
3
+ class ArgumentySestavy
4
+
5
+ attr_accessor :od_data, :do_data, :uzivatel_id
6
+ alias_method :k_datu, :od_data
7
+ def k_datu=(datum); @od_data = datum; @do_data = datum; end
8
+
9
+ def initialize(args={})
10
+ args.each_pair{|k, v| send "#{k}=", v }
11
+ end
12
+
13
+ def jeden_datum?
14
+ @od_data==@do_data
15
+ end
16
+
17
+ def argumenty_sloupce(arr)
18
+ arr.map{|a| a.class==Symbol ? send(a) : a}
19
+ end
20
+
21
+ def to_s
22
+ return @to_s if defined? @to_s
23
+ @to_s = if jeden_datum?
24
+ "#{I18n.l(@od_data, format: :excel)[0..-2]}"
25
+ else
26
+ "#{I18n.l(@od_data, format: :excel)[0..-2]}_#{I18n.l(@do_data, format: :excel)[0..-2]}"
27
+ end
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+ module XLSSestavy
3
+ class DefiniceSloupcu < RadaSloupcu
4
+
5
+ def self.[](klic)
6
+ ds = DefiniceSloupcu.cache_definic[klic]
7
+ if ds.class==Class
8
+ ds = ds.new
9
+ ds.definice
10
+ ds.aktualizuj_seznam
11
+ DefiniceSloupcu.cache_definic[klic] = ds
12
+ end
13
+ ds
14
+ end
15
+
16
+ def self.pridej_jako_definice(klic)
17
+ DefiniceSloupcu.cache_definic[klic] = self
18
+ end
19
+
20
+ def definice; end
21
+
22
+ def definuj(*args, &block)
23
+ @sloupce << PreddefinovanySloupec.new(*args, &block)
24
+ end
25
+
26
+ private
27
+
28
+ def self.cache_definic
29
+ @cache_definic ||= {}
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,65 @@
1
+ # encoding: utf-8
2
+ module XLSSestavy
3
+ module ExcelFormaty
4
+
5
+ #do uchovávaného pole zapíše pod daným symbolem nový formát využívaný ostatními metodami
6
+ def add_format(symbol, *args)
7
+ @formaty = {} unless defined? @formaty
8
+ @formaty[symbol] = @wb.add_format *args
9
+ end
10
+
11
+ def add_altered_format(symbol, format, zmeny_hash)
12
+ @formaty = {} unless defined? @formaty
13
+ @formaty[symbol] = alter_format format, zmeny_hash
14
+ end
15
+
16
+ # vytáhne vytvořený formát podle symbolu
17
+ def get_format(symbol=nil)
18
+ @formaty = {} unless defined? @formaty
19
+ unless symbol
20
+ @format = :default unless defined? @format
21
+ symbol = @format
22
+ end
23
+ f = @formaty[symbol]
24
+ return f if f
25
+ add_default_format symbol
26
+ end
27
+
28
+ def alter_format(format, zmeny_hash)
29
+ f = @wb.add_format
30
+ f.copy format
31
+ f.set_format_properties zmeny_hash
32
+ f
33
+ end
34
+
35
+ #aktivní format je využíván dalšímí metodami
36
+ def set_aktivni_format(format)
37
+ @format = format
38
+ end
39
+
40
+ #definice defaultních formátů (voláno z add_format)
41
+ def add_default_format(symbol)
42
+ case symbol
43
+ when :sestava_nadpis
44
+ add_format symbol, bold: 1, size: 15, bg_color: 52, align: 'left'
45
+ when :sestava_nadpis2
46
+ add_format symbol, size: 12, bold: 1, align: 'left'
47
+ when :sestava_info
48
+ add_format symbol, italic: 1
49
+ when :zahlavi
50
+ add_format symbol, bold: 1, border: 1, text_wrap: 1, align: 'center', bg_color: 22
51
+ when :data
52
+ add_format symbol, text_wrap: 1, border: 1
53
+ when :data_stred
54
+ add_format symbol, text_wrap: 1, border: 1, align: 'center'
55
+ when :souctovy_radek
56
+ add_format symbol, align: 'right', bg_color: 42, bold: 1, border: 1
57
+ when :default
58
+ add_format symbol
59
+ else
60
+ raise "Formát :#{symbol} není definován"
61
+ end
62
+ end
63
+
64
+ end
65
+ end
@@ -0,0 +1,96 @@
1
+ # encoding: utf-8
2
+ module XLSSestavy
3
+ #převod cm na points pro řádky
4
+ def self.row_cm_to_p(cm)
5
+ (cm*28.3464567).to_i
6
+ end
7
+
8
+ #převod cm na points pro sloupce
9
+ #přibližně .. (nenalezen přesný výpočet)
10
+ def self.col_cm_to_p(cm)
11
+ (cm*28.3464567/5.6).to_i
12
+ end
13
+
14
+ #převod z mm na palce
15
+ def self.mm_to_inch(mm)
16
+ mm/25.4
17
+ end
18
+
19
+ #číslo sloupce ze znaků ('A' => 0)
20
+ # do maximální hodnoty 'ZZ'
21
+ def self.sloupec_cislo(znak)
22
+ znak.upcase!
23
+ if znak.length==1
24
+ znak.ord-65
25
+ elsif znak.length==2
26
+ (znak[0].ord-64)*26 + znak[1].ord-65
27
+ end
28
+ end
29
+
30
+ #písmeno sloupce z čísla (0 => 'A')
31
+ # do maximální hodnoty 'ZZ'
32
+ def self.sloupec_pismeno(cislo)
33
+ return (cislo+65).chr if cislo < 26
34
+ a = (cislo/26) - 1
35
+ b = cislo%26
36
+ "#{(a+65).chr}#{(b+65).chr}"
37
+ end
38
+
39
+ #převod standartních souřadnic na pole číselných souradnic:
40
+ # 'A3' => [[2,0]], 'A5:B7' => [[4,0],[6,1]] <radek, sloupec>
41
+ def self.ciselne_souradnice(bunky)
42
+ a = bunky.match /^(\D+)(\d+)(:(\D+)(\d+))?$/
43
+ return unless a
44
+ souradnice = [[a[2].to_i-1, sloupec_cislo(a[1])]]
45
+ souradnice << [a[5].to_i-1, sloupec_cislo(a[4])] if a[3]
46
+ souradnice
47
+ end
48
+
49
+ #doupravuje hodnotu buňky, aby nedošlo na předvídatelné konflikty.
50
+ #Důležité pro všechny typy času/datumu, protože to je potřeba převést na textový řetězec pro excel stravitelný
51
+ def self.douprav_hodnotu_bunky(hodnota)
52
+ case hodnota
53
+ when Hash
54
+ ret = '---'
55
+ hodnota.each_pair{|k, v| ret += "\n#{k}: #{v}"}
56
+ ret
57
+ when Array
58
+ hodnota.join ', '
59
+ when Time, DateTime, Date
60
+ I18n.l hodnota, format: :excel
61
+ when NilClass
62
+ ''
63
+ else
64
+ hodnota
65
+ end
66
+ end
67
+
68
+ #klíč num_formátu pro excel
69
+ def self.num_format(sym)
70
+ case sym
71
+ when :cas
72
+ 'yyyy-MM-dd HH:mm:ss'
73
+ when :datum
74
+ 'd. M. yyyy'
75
+ when :suma
76
+ "#,###0.00 #{@def_mena}"
77
+ when :pocet
78
+ '#,##0'
79
+ when :cislo_smlouvy
80
+ '#0'
81
+ else
82
+ raise "nedefinovaný num_format: #{sym}"
83
+ end
84
+ end
85
+
86
+
87
+ def self.def_mena=(mena)
88
+ @def_mena = case mena
89
+ when '€'; '[$€-4B1]'
90
+ when 'Kč'; '[$Kč-405]'
91
+ else; '??'
92
+ end
93
+ end
94
+ self.def_mena = 'Kč'
95
+
96
+ end
@@ -0,0 +1,148 @@
1
+ # encoding: utf-8
2
+ module XLSSestavy
3
+ module ExcelTabulky
4
+
5
+ # vytvoří list, zapíše jej do @ws a vrátí jej. mezi tím případně provede předaný blok
6
+ def vytvor_list(nazev)
7
+ @ws = @wb.add_worksheet nazev
8
+ yield @ws if block_given?
9
+ @ws
10
+ end
11
+
12
+ # roztahuje se na (defaultně) 24 sloupců v prvním řádku
13
+ def sestava_nadpis(text, roztahnout=24, radek=0)
14
+ @ws.merge_range radek, 0, radek, roztahnout-1, text, get_format(:sestava_nadpis)
15
+ @ws.set_row radek, XLSSestavy.row_cm_to_p(1)
16
+ end
17
+
18
+ # pozice ve standartních excel souřadnicích 'A2', 'B3:B5' (spojení buňek)
19
+ # vyska znamená výška daného řádku v cm
20
+ def sestava_napdis2(text, pozice, vyska = 0.7)
21
+ zapis pozice, text, get_format(:sestava_nadpis2)
22
+ @ws.set_row ciselne_souradnice(pozice)[0][0], XLSSestavy.row_cm_to_p(vyska)
23
+ end
24
+
25
+ #pozice ve standartních excel souřadnicích 'A2', 'B3:B5' (spojení buňek)
26
+ def sestava_cas_vytvoreni(pozice='A2')
27
+ cas = "začátek zpracování: #{l Time.now}"
28
+ zapis pozice, cas, get_format(:default)
29
+ end
30
+
31
+ # pozice bunkdy jsou ve standartních souřadnicích ( 'A3')
32
+ def zapis(bunky, hodnota, format=nil)
33
+ format = get_format unless format
34
+ souradnice = XLSSestavy.ciselne_souradnice bunky
35
+ if souradnice.length==1
36
+ @ws.write souradnice[0][0], souradnice[0][1], hodnota, format
37
+ else
38
+ @ws.merge_range souradnice[0][0], souradnice[0][1], souradnice[1][0], souradnice[1][1], hodnota, format
39
+ end
40
+ end
41
+
42
+ def zapis_radu(prvni_bunka, hodnoty, format=nil)
43
+ format = get_format unless format
44
+ souradnice = XLSSestavy.ciselne_souradnice(prvni_bunka).first
45
+ hodnoty.each do |h|
46
+ @ws.write souradnice[0], souradnice[1], h, format
47
+ souradnice[1] += 1
48
+ end
49
+ end
50
+
51
+ def zapis_sloupec(prvni_bunka, hodnoty, format=nil)
52
+ format = get_format unless format
53
+ souradnice = XLSSestavy.ciselne_souradnice(prvni_bunka).first
54
+ hodnoty.each do |h|
55
+ @ws.write souradnice[0], souradnice[1], h, format
56
+ souradnice[0] += 1
57
+ end
58
+ end
59
+
60
+ #vypsání dat tabulky, hlaviček a případných součtových řádků
61
+ # vrací počet, kolik řádků bylo vypsáno
62
+ # objekty = <Array<Object>> / <ActiveRecord::Relation>
63
+ # sloupce: <Array<Sloupec>> / <RadaSloupcu> -pole sloupců
64
+ #--- args ---
65
+ # vyska_zahlavi: <Numerical> -hodnota výšky prvního řádku v cm
66
+ # ukotvit_zahlavi: <True> / <Nil> -pokud má být za hlavičkou ukotveno(o jeden řádek níže při použití součtových řádků :nad)
67
+ # soucty: :nad, :pod, :nad_pod, :prazdne, nil
68
+ # format_zahlavi: <Symbol> -formát hlavičky (bude upraven formátem sloupce)
69
+ # format_dat: <Symbol> -formát řádků dat (bude upraven formátem sloupce)
70
+ def vypis_tabulku(pozice, objekty, sloupce, args={})
71
+ y, x = XLSSestavy.ciselne_souradnice(pozice).first
72
+ sloupce = sloupce.sloupce if sloupce.kind_of? RadaSloupcu
73
+ soucty = args[:soucty]
74
+ soucty = :prazdne if objekty.length==0 && soucty
75
+
76
+ dy = 0 # posun v řádcích
77
+ #hlavičky
78
+ format_zahlavi = get_format args[:format_zahlavi]||:zahlavi
79
+ formaty = sloupce.map do |s|
80
+ next format_zahlavi unless s.format.class==Hash
81
+ format_hash = s.format.clone
82
+ format_hash[:num_format] = nil
83
+ alter_format format_zahlavi, format_hash
84
+ end
85
+ sloupce.each_with_index do |s, i|
86
+ x_sloupce = x + i
87
+ @ws.write y, x_sloupce, s.zahlavi, formaty[i]
88
+ @ws.set_column x_sloupce, x_sloupce, XLSSestavy.col_cm_to_p(s.sirka)
89
+ end
90
+ @ws.set_row y, XLSSestavy.row_cm_to_p(args[:vyska_zahlavi]||1.3)
91
+ dy += 1
92
+ #součty :nad
93
+ y_soucty = y+dy+1
94
+ if soucty==:nad || soucty==:nad_pod
95
+ y_soucty += 1
96
+ vypis_souctovy_radek y+dy, x, sloupce, [y_soucty..y_soucty+objekty.length-1]
97
+ dy += 1
98
+ end
99
+ #ukotvit
100
+ @ws.freeze_panes y+dy, 0 if args[:ukotvit_zahlavi]
101
+ #vypsani samotnych dat
102
+ format_dat = get_format args[:format_dat]||:data
103
+ formaty = sloupce.map do |s|
104
+ next format_dat unless s.format.class==Hash
105
+ alter_format format_dat, s.format
106
+ end
107
+ objekty.each do |objekt|
108
+ sloupce.each_with_index do |s, i|
109
+ hodnota = XLSSestavy.douprav_hodnotu_bunky s.hodnota_pro(objekt)
110
+ if s.num_format==:cas || s.num_format==:datum
111
+ @ws.write_date_time y+dy, x+i, hodnota, formaty[i]
112
+ else
113
+ @ws.write y+dy, x+i, hodnota, formaty[i]
114
+ end
115
+ end
116
+ dy += 1
117
+ end
118
+ #součty :pod
119
+ if soucty==:pod || soucty==:nad_pod
120
+ vypis_souctovy_radek y+dy, x, sloupce, [y_soucty..y_soucty+objekty.length-1]
121
+ dy += 1
122
+ end
123
+ #případně, když nejsou žádné objekty jenom prázdný součtový řádek
124
+ if soucty==:prazdne
125
+ format = get_format :souctovy_radek
126
+ sloupce.length.times{|i| @ws.write y+dy, x+i, '', format }
127
+ dy += 1
128
+ end
129
+ dy
130
+ end
131
+
132
+ def vypis_souctovy_radek(y, x, sloupce, rozsah)
133
+ format = get_format :souctovy_radek
134
+ sloupce.each_with_index do |s, i|
135
+ pismeno = XLSSestavy.sloupec_pismeno x
136
+ formule = case s.souctovy_radek
137
+ when :soucet; "SUBTOTAL(9,#{pismeno}#{rozsah.min}:#{pismeno}#{rozsah.max})"
138
+ when :pocet; "SUBTOTAL(9,#{pismeno}#{rozsah.min}:#{pismeno}#{rozsah.max})"
139
+ else
140
+ @ws.write y, x+i, '', format
141
+ next
142
+ end
143
+ @ws.write_formula y, x+i, formule, format
144
+ end
145
+ end
146
+
147
+ end
148
+ end
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+ module XLSSestavy
3
+ class PreddefinovanySloupec < Sloupec
4
+
5
+ attr_reader :klic
6
+
7
+ def initialize(klic, zahlavi, args={}, &block)
8
+ super zahlavi, args, &block
9
+ @klic = klic.to_sym
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+ module XLSSestavy
3
+ class RadaSloupcu
4
+
5
+ attr_reader :sloupce
6
+
7
+ def initialize(sloupce=nil, argumenty=nil)
8
+ @sloupce = sloupce || []
9
+ yield self if block_given?
10
+ if @sloupce.class!=Array && @sloupce.any?{|s| !s.kind_of? Sloupec}
11
+ raise 'RadaSloupcu musí být inicializovány polem Sloupců'
12
+ end
13
+ @sloupce.each{|s| s.nastav_argumenty argumenty} if argumenty
14
+ @seznam = {}
15
+ aktualizuj_seznam
16
+ end
17
+
18
+ def pridej(*args, &block)
19
+ if args.first.is_a? Sloupec
20
+ @sloupce << args.first
21
+ else
22
+ @sloupce << Sloupec.new(*args, &block)
23
+ end
24
+ end
25
+
26
+ def [](klic)
27
+ index = @seznam[klic.to_sym]
28
+ index ? @sloupce[index] :nil
29
+ end
30
+
31
+ protected
32
+
33
+ def aktualizuj_seznam
34
+ @seznam = {}
35
+ @sloupce.each_with_index do |s,i|
36
+ @seznam[s.klic] = i if s.class==PreddefinovanySloupec
37
+ end
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+ require 'tempfile'
3
+ require 'xls_sestavy/excel_formaty'
4
+ require 'xls_sestavy/excel_tabulky'
5
+
6
+
7
+ module XLSSestavy
8
+ class Sestava
9
+ NAZEV = 'Prázdná sestava'
10
+
11
+ include ExcelTabulky
12
+ include ExcelFormaty
13
+
14
+ attr_reader :argumenty
15
+
16
+ def initialize(args={})
17
+ @argumenty = ArgumentySestavy.new args
18
+ end
19
+
20
+ def vytvor_soubor
21
+ f = Tempfile.new self.class::NAZEV.gsub(' ','_'), Rails.root.join('tmp')
22
+ @wb = WriteExcel.new f
23
+ vypracuj_sestavu
24
+ @wb.close
25
+ block_given? ? yield(f) : po_vypracovani(f)
26
+ end
27
+
28
+ def vypracuj_sestavu; end
29
+
30
+ def po_vypracovani(f); end
31
+
32
+ def nazev_souboru
33
+ to_s + '.xls'
34
+ end
35
+
36
+ def to_s
37
+ "#{self.class::NAZEV.gsub(' ','_')}_#{@argumenty.to_s}"
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+ module XLSSestavy
3
+ class Sloupec
4
+
5
+ attr_accessor :zahlavi, :sirka, :format, :num_format, :souctovy_radek
6
+
7
+ def initialize(zahlavi, args={}, &block)
8
+ @zahlavi= zahlavi
9
+ @fce = args[:fce] || block
10
+ nastav args
11
+ end
12
+
13
+ def nastav(args={})
14
+ @parametry = args[:parametry] || []
15
+ @sirka = args[:sirka] || 3
16
+ @souctovy_radek = args[:souctovy_radek]
17
+ @format = args[:format]
18
+ @num_format = args[:num_format]
19
+ if @num_format
20
+ @format ||= {}
21
+ @format[:num_format] = XLSSestavy.num_format @num_format
22
+ end
23
+ end
24
+
25
+ def nastav_argumenty(argumenty)
26
+ @argumenty_array = argumenty.argumenty_sloupce(@parametry)
27
+ @zahlavi.gsub!(/%\w+%/){|m| argumenty.send m[1..-2]}
28
+ end
29
+
30
+ def hodnota_pro(objekt)
31
+ if @fce.class==Proc
32
+ @fce.call(objekt, *@argumenty_array)
33
+ elsif objekt.respond_to? @fce
34
+ objekt.send(@fce, *@argumenty_array)
35
+ else
36
+ raise "Není definováno pro @fce=#{@fce.class}:#{@fce}"
37
+ end
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ module XLSSestavy
3
+ VERSION = "0.2.3"
4
+
5
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+ require "xls_sestavy/version"
3
+ require "xls_sestavy/excel_helper"
4
+
5
+ require 'xls_sestavy/sloupec'
6
+ require 'xls_sestavy/preddefinovany_sloupec'
7
+ require 'xls_sestavy/rada_sloupcu'
8
+ require 'xls_sestavy/definice_sloupcu'
9
+
10
+ require 'xls_sestavy/argumenty_sestavy'
11
+ require 'xls_sestavy/sestava'
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xls_sestavy/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xls_sestavy"
8
+ spec.version = XLSSestavy::VERSION
9
+ spec.authors = ["Ondřej Želazko"]
10
+ spec.email = ["zelazk.o@email.cz"]
11
+ spec.description = %q(Uses writeexcel and puts some helper methods on top for making summaries in xls format)
12
+ spec.summary = %q(xls simple helper library)
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xls_sestavy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.3
5
+ platform: ruby
6
+ authors:
7
+ - Ondřej Želazko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Uses writeexcel and puts some helper methods on top for making summaries
42
+ in xls format
43
+ email:
44
+ - zelazk.o@email.cz
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - lib/xls_sestavy.rb
55
+ - lib/xls_sestavy/argumenty_sestavy.rb
56
+ - lib/xls_sestavy/definice_sloupcu.rb
57
+ - lib/xls_sestavy/excel_formaty.rb
58
+ - lib/xls_sestavy/excel_helper.rb
59
+ - lib/xls_sestavy/excel_tabulky.rb
60
+ - lib/xls_sestavy/preddefinovany_sloupec.rb
61
+ - lib/xls_sestavy/rada_sloupcu.rb
62
+ - lib/xls_sestavy/sestava.rb
63
+ - lib/xls_sestavy/sloupec.rb
64
+ - lib/xls_sestavy/version.rb
65
+ - xls_sestavy.gemspec
66
+ homepage: ''
67
+ licenses:
68
+ - MIT
69
+ metadata: {}
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project:
86
+ rubygems_version: 2.1.11
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: xls simple helper library
90
+ test_files: []