class ExcelXml::Worksheet::Parser
Attributes
header_row_index[RW]
worksheet[R]
Public Class Methods
new(worksheet)
click to toggle source
# File lib/excelxml/worksheet.rb, line 39 def initialize worksheet @worksheet = worksheet end
Public Instance Methods
has_header?(header)
click to toggle source
# File lib/excelxml/worksheet.rb, line 51 def has_header? header index_to_header_map.find {|e| e.match header } end
index_to_header_map()
click to toggle source
# File lib/excelxml/worksheet.rb, line 55 def index_to_header_map @index_to_header_map ||= @worksheet.rows[header_row_index].collect {|h| h ? h.strip : nil } end
is_header?(row_number, fields)
click to toggle source
# File lib/excelxml/worksheet.rb, line 67 def is_header? row_number, fields return true if mandatory_columns.all? {|mc| fields.compact.any? {|f| f.match mc } } return false end
mandatory_columns()
click to toggle source
Override methods
# File lib/excelxml/worksheet.rb, line 63 def mandatory_columns [] end
rows()
click to toggle source
# File lib/excelxml/worksheet.rb, line 43 def rows @rows ||= begin @worksheet.rows[(header_row_index+1)..-1].collect do |fields| Fields.new(self, fields) end end end