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


50
51
52
53
54
55
56
57
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 50

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


38
39
40
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 38

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

#conditional_formattings=(conditional_formattings) ⇒ Object


34
35
36
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 34

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

#load!Object


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

def load!
  return if folder.blank?

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

#loaded?Boolean

Returns:

  • (Boolean)

46
47
48
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 46

def loaded?
  loaded
end

#ranges=(ranges) ⇒ Object


42
43
44
# File 'app/sequencescape_excel/sequencescape_excel/configuration.rb', line 42

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