Class: XLSSestavy::Sloupec
- Inherits:
-
Object
- Object
- XLSSestavy::Sloupec
- Defined in:
- lib/xls_sestavy/sloupec.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#num_format ⇒ Object
Returns the value of attribute num_format.
-
#sirka ⇒ Object
Returns the value of attribute sirka.
-
#souctovy_radek ⇒ Object
Returns the value of attribute souctovy_radek.
-
#zahlavi ⇒ Object
Returns the value of attribute zahlavi.
Instance Method Summary collapse
- #hodnota_pro(objekt) ⇒ Object
-
#initialize(zahlavi, args = {}, &block) ⇒ Sloupec
constructor
A new instance of Sloupec.
- #nastav(args = {}) ⇒ Object
- #nastav_argumenty(argumenty) ⇒ Object
Constructor Details
#initialize(zahlavi, args = {}, &block) ⇒ Sloupec
Returns a new instance of Sloupec.
7 8 9 10 11 |
# File 'lib/xls_sestavy/sloupec.rb', line 7 def initialize(zahlavi, args={}, &block) @zahlavi= zahlavi @fce = args[:fce] || block nastav args end |
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
5 6 7 |
# File 'lib/xls_sestavy/sloupec.rb', line 5 def format @format end |
#num_format ⇒ Object
Returns the value of attribute num_format.
5 6 7 |
# File 'lib/xls_sestavy/sloupec.rb', line 5 def num_format @num_format end |
#sirka ⇒ Object
Returns the value of attribute sirka.
5 6 7 |
# File 'lib/xls_sestavy/sloupec.rb', line 5 def sirka @sirka end |
#souctovy_radek ⇒ Object
Returns the value of attribute souctovy_radek.
5 6 7 |
# File 'lib/xls_sestavy/sloupec.rb', line 5 def souctovy_radek @souctovy_radek end |
#zahlavi ⇒ Object
Returns the value of attribute zahlavi.
5 6 7 |
# File 'lib/xls_sestavy/sloupec.rb', line 5 def zahlavi @zahlavi end |
Instance Method Details
#hodnota_pro(objekt) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/xls_sestavy/sloupec.rb', line 30 def hodnota_pro(objekt) if @fce.class==Proc @fce.call(objekt, *@argumenty_array) elsif objekt.respond_to? @fce objekt.send(@fce, *@argumenty_array) else raise "Není definováno pro @fce=#{@fce.class}:#{@fce}" end end |
#nastav(args = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/xls_sestavy/sloupec.rb', line 13 def nastav(args={}) @parametry = args[:parametry] || [] @sirka = args[:sirka] || 3 @souctovy_radek = args[:souctovy_radek] @format = args[:format] @num_format = args[:num_format] if @num_format @format ||= {} @format[:num_format] = XLSSestavy.num_format @num_format end end |
#nastav_argumenty(argumenty) ⇒ Object
25 26 27 28 |
# File 'lib/xls_sestavy/sloupec.rb', line 25 def nastav_argumenty(argumenty) @argumenty_array = argumenty.argumenty_sloupce(@parametry) @zahlavi.gsub!(/%\w+%/){|m| argumenty.send m[1..-2]} end |