Class: SequencescapeExcel::ConditionalFormattingDefault

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

Overview

Default conditional formatting rule. See conditional formatting.

Instance Method Summary collapse

Methods included from Helpers::Attributes

#<=>, #to_a

Constructor Details

#initialize(attributes = {}) ⇒ ConditionalFormattingDefault

Returns a new instance of ConditionalFormattingDefault


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

def initialize(attributes = {})
  super
end

Instance Method Details

#combine(other = nil) ⇒ Object


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

def combine(other = nil)
  (other || {}).merge(style: style, options: options).with_indifferent_access.tap do |cf|
    if expression?
      cf[:formula] ||= {}
      cf[:formula].merge!(type: type)
    end
  end
end

#expression?Boolean

Returns:

  • (Boolean)

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

def expression?
  options[:type] == :expression
end

#inspectObject


33
34
35
# File 'app/sequencescape_excel/sequencescape_excel/conditional_formatting_default.rb', line 33

def inspect
  "<#{self.class}: @type=#{type}, @style=#{style}, @options=#{options}>"
end

#type=(type) ⇒ Object


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

def type=(type)
  @type = type.to_sym
end