Class: BulkSubmissionExcel::Download

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, SequencescapeExcel::Helpers::Download
Defined in:
app/bulk_submission_excel/bulk_submission_excel/download.rb

Overview

Download

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SequencescapeExcel::Helpers::Download

#save, #workbook, #xls

Constructor Details

#initialize(*args) ⇒ Download

Returns a new instance of Download


14
15
16
17
18
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 14

def initialize(*args)
  super
  ranges_worksheet
  data_worksheet
end

Instance Attribute Details

#assetsObject

Returns the value of attribute assets


12
13
14
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 12

def assets
  @assets
end

#column_listObject

Returns the value of attribute column_list


12
13
14
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 12

def column_list
  @column_list
end

#defaultsObject

Returns the value of attribute defaults


12
13
14
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 12

def defaults
  @defaults
end

#range_listObject

Returns the value of attribute range_list


12
13
14
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 12

def range_list
  @range_list
end

#submission_templateObject

Returns the value of attribute submission_template


12
13
14
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 12

def submission_template
  @submission_template
end

Instance Method Details

#data_worksheetObject


36
37
38
39
40
41
42
43
44
45
46
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 36

def data_worksheet
  return nil unless valid?

  @data_worksheet ||= BulkSubmissionExcel::Worksheet::DataWorksheet.new(
    workbook: workbook,
    columns: column_list,
    assets: assets,
    ranges: range_list,
    defaults: defaults
  )
end

#inspectObject


48
49
50
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 48

def inspect
  "<#{self.class}: @submission_template=#{@submission_template}, @assets=#{@assets} ...>"
end

#new_record?Boolean

Returns:

  • (Boolean)

20
21
22
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 20

def new_record?
  true
end

#ranges_worksheetObject


24
25
26
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 24

def ranges_worksheet
  @ranges_worksheet ||= SequencescapeExcel::Worksheet::RangesWorksheet.new(ranges: range_list, workbook: workbook) if valid?
end

#submission_template_idObject


32
33
34
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 32

def submission_template_id
  submission_template&.id
end

#submission_template_id=(id) ⇒ Object


28
29
30
# File 'app/bulk_submission_excel/bulk_submission_excel/download.rb', line 28

def submission_template_id=(id)
  self.submission_template = SubmissionTemplate.find_by(id: id)
end