Class: ExcelXml::Fields
- Inherits:
-
Array
- Object
- Array
- ExcelXml::Fields
- Defined in:
- lib/excelxml/worksheet.rb
Instance Method Summary collapse
- #[](regexp) ⇒ Object
-
#initialize(*args) ⇒ Fields
constructor
A new instance of Fields.
Constructor Details
#initialize(*args) ⇒ Fields
Returns a new instance of Fields.
72 73 74 75 |
# File 'lib/excelxml/worksheet.rb', line 72 def initialize *args super(*args[0..-2]) @index_to_header_map = args.last end |
Instance Method Details
#[](regexp) ⇒ Object
76 77 78 79 80 81 |
# File 'lib/excelxml/worksheet.rb', line 76 def [] regexp return super unless regexp.is_a? Regexp idx = @index_to_header_map.find_index {|e| e.match regexp } raise "#{regexp.inspect} not found in #{@index_to_header_map.inspect}." if idx.nil? super(idx).extend Field end |