Class: Decisive::RenderXLSContext
- Inherits:
-
Struct
- Object
- Struct
- Decisive::RenderXLSContext
- Defined in:
- lib/decisive/render_xls_context.rb
Defined Under Namespace
Classes: Worksheet
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#worksheets ⇒ Object
Returns the value of attribute worksheets.
Instance Method Summary collapse
- #csv? ⇒ Boolean
-
#initialize(*args) ⇒ RenderXLSContext
constructor
A new instance of RenderXLSContext.
- #to_xls ⇒ Object
Constructor Details
#initialize(*args) ⇒ RenderXLSContext
Returns a new instance of RenderXLSContext.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/decisive/render_xls_context.rb', line 8 def initialize *args super self.worksheets ||= [] if worksheets.none? instance_eval &block else self.worksheets = worksheets.map do |name, records| Worksheet.new(records, name, block) end end end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block
5 6 7 |
# File 'lib/decisive/render_xls_context.rb', line 5 def block @block end |
#filename ⇒ Object
Returns the value of attribute filename
5 6 7 |
# File 'lib/decisive/render_xls_context.rb', line 5 def filename @filename end |
#worksheets ⇒ Object
Returns the value of attribute worksheets
5 6 7 |
# File 'lib/decisive/render_xls_context.rb', line 5 def worksheets @worksheets end |
Instance Method Details
#csv? ⇒ Boolean
28 29 30 |
# File 'lib/decisive/render_xls_context.rb', line 28 def csv? false end |
#to_xls ⇒ Object
22 23 24 25 26 |
# File 'lib/decisive/render_xls_context.rb', line 22 def to_xls workbook = RubyXL::Workbook.new workbook.worksheets.pop # rm default worsheet to_string(render(workbook)) end |