Class: Xlsx2Mysql::Column

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, regexp = /(.*)/) ⇒ Column

Returns a new instance of Column.



5
6
7
8
# File 'lib/xlsx2mysql/column.rb', line 5

def initialize(name, regexp = /(.*)/)
  @name = name
  @regexp = regexp
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/xlsx2mysql/column.rb', line 3

def name
  @name
end

#regexpObject

Returns the value of attribute regexp.



3
4
5
# File 'lib/xlsx2mysql/column.rb', line 3

def regexp
  @regexp
end

Instance Method Details

#+(other_column) ⇒ Object



10
11
12
# File 'lib/xlsx2mysql/column.rb', line 10

def + other_column
  Columns.new(self, other_column)
end

#retrieve_value(row_index, ws) ⇒ Object



14
15
16
17
18
# File 'lib/xlsx2mysql/column.rb', line 14

def retrieve_value row_index, ws
  index = name.to_s + row_index.to_s
  regexp.match(ws[index])
  $1
end