Class: Osheet::Template
- Includes:
- Instance
- Defined in:
- lib/osheet/template.rb
Constant Summary collapse
- ELEMENTS =
['worksheet', 'column', 'row', 'cell']
Instance Method Summary collapse
- #element ⇒ Object
- #element=(v) ⇒ Object
-
#initialize(element, name) ⇒ Template
constructor
A new instance of Template.
Methods inherited from Partial
Constructor Details
#initialize(element, name) ⇒ Template
Returns a new instance of Template.
14 15 16 17 18 19 20 21 |
# File 'lib/osheet/template.rb', line 14 def initialize(element, name) unless element.respond_to?(:to_s) && ELEMENTS.include?(element.to_s) raise ArgumentError, "you can only define a template for #{ELEMENTS.join(', ')} elements." end set_ivar(:element, element.to_s) super(name) end |
Instance Method Details
#element ⇒ Object
23 |
# File 'lib/osheet/template.rb', line 23 def element; get_ivar(:element); end |
#element=(v) ⇒ Object
24 |
# File 'lib/osheet/template.rb', line 24 def element=(v); set_ivar(:element, v); end |