Class: Xlsx2Mysql::Columns

Inherits:
Object
  • Object
show all
Defined in:
lib/xlsx2mysql/column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Columns

Returns a new instance of Columns.



24
25
26
# File 'lib/xlsx2mysql/column.rb', line 24

def initialize *args
  @columns = args
end

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



22
23
24
# File 'lib/xlsx2mysql/column.rb', line 22

def columns
  @columns
end

Instance Method Details

#+(x) ⇒ Object



28
29
30
31
# File 'lib/xlsx2mysql/column.rb', line 28

def + x
  columns << x
  self
end

#retrieve_value(row_index, ws) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/xlsx2mysql/column.rb', line 33

def retrieve_value row_index, ws
  res_array = []
  columns.each do |x|
    if x.is_a?(Column)
      res_array << x.retrieve_value(row_index, ws)
    elsif x.is_a?(String)
      res_array << x
    else
    end
  end
  res_array.join
end