Class: ExcelXml::Fields

Inherits:
Array
  • Object
show all
Defined in:
lib/excelxml/worksheet.rb

Instance Method Summary collapse

Constructor Details

#initialize(parser, raw_fields) ⇒ Fields

Returns a new instance of Fields.



76
77
78
79
# File 'lib/excelxml/worksheet.rb', line 76

def initialize parser, raw_fields
  super(raw_fields)
  @parser = parser
end

Instance Method Details

#[](key) ⇒ Object



83
84
85
86
87
# File 'lib/excelxml/worksheet.rb', line 83

def [] key
  if idx = @parser.instance_eval { index_to_header_map.find_index {|e| e.match key } }
    self[idx] = super(idx) || Field.new
  end
end

#has_header?(header) ⇒ Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/excelxml/worksheet.rb', line 80

def has_header? header
  @parser.has_header? header
end