Class: CaxlsxBuilder::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/caxlsx_builder/cell.rb

Instance Method Summary collapse

Constructor Details

#initialize(style: :default, type: :string) ⇒ Cell

Returns a new instance of Cell.



5
6
7
8
# File 'lib/caxlsx_builder/cell.rb', line 5

def initialize(style: :default, type: :string)
  @style = style
  @type  = type
end

Instance Method Details

#as_style(item, rescue_errors: false) ⇒ Object



10
11
12
13
14
15
# File 'lib/caxlsx_builder/cell.rb', line 10

def as_style(item, rescue_errors: false)
  style = @style.respond_to?(:call) ? call_style_proc(item, rescue_errors:) : @style
  type  = @type.respond_to?(:call) ? call_type_proc(item, rescue_errors:) : @type

  { style:, type: }
end