Class: SequencescapeExcel::Configuration

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
app/sequencescape_excel/sequencescape_excel/configuration.rb

Overview

Configuration class for sample manifests handling fornatting, manifest types, ranges and columns.

Defined Under Namespace

Classes: Columns

Constant Summary collapse

FILES =
%i[conditional_formattings ranges columns].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#load_file

Constructor Details

#initialize {|_self| ... } ⇒ Configuration

Returns a new instance of Configuration.

Yields:

  • (_self)

Yield Parameters:


15
16
17
18
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 15

def initialize
  @files = self.class::FILES.dup
  yield self if block_given?
end

Instance Attribute Details

#column_setsObject

Returns the value of attribute column_sets.


12
13
14
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 12

def column_sets
  @column_sets
end

#folderObject

Returns the value of attribute folder.


12
13
14
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 12

def folder
  @folder
end

#tag_groupObject

Returns the value of attribute tag_group.


12
13
14
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 12

def tag_group
  @tag_group
end

Instance Method Details

#==(other) ⇒ Object


48
49
50
51
52
53
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 48

def ==(other)
  return false unless other.is_a?(self.class)

  folder == other.folder && conditional_formattings == other.conditional_formattings && ranges == other.ranges &&
    columns == other.columns
end

#add_file(file) ⇒ Object


20
21
22
23
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 20

def add_file(file)
  @files << file.to_sym
  class_eval { attr_accessor file.to_sym }
end

#columns=(columns) ⇒ Object


36
37
38
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 36

def columns=(columns)
  @columns = Columns.new(columns, conditional_formattings, column_sets).freeze
end

#conditional_formattings=(conditional_formattings) ⇒ Object


32
33
34
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 32

def conditional_formattings=(conditional_formattings)
  @conditional_formattings = ConditionalFormattingDefaultList.new(conditional_formattings).freeze
end

#load!Object


25
26
27
28
29
30
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 25

def load!
  return if folder.blank?

  @files.each { |file| send("#{file}=", load_file(folder, file.to_s)) }
  @loaded = true
end

#loaded?Boolean

Returns:

  • (Boolean)

44
45
46
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 44

def loaded?
  loaded
end

#ranges=(ranges) ⇒ Object


40
41
42
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 40

def ranges=(ranges)
  @ranges = RangeList.new(ranges).freeze
end