Class: RubyFromExcel::SharedStrings

Inherits:
Array
  • Object
show all
Includes:
Singleton
Defined in:
lib/excelfile/shared_strings.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.shared_string_for(index) ⇒ Object


6
7
8
# File 'lib/excelfile/shared_strings.rb', line 6

def self.shared_string_for(index)
  self.instance.shared_string_for(index)
end

Instance Method Details

#load_strings_from_xml(xml) ⇒ Object


10
11
12
13
14
15
# File 'lib/excelfile/shared_strings.rb', line 10

def load_strings_from_xml(xml)
  xml.css("si").each do |si|
    push si.css("t").map(&:content).join
    RubyFromExcel.debug(:shared_strings,"#{self.size-1}: #{self.last.inspect}")
  end
end

#shared_string_for(index) ⇒ Object


17
18
19
# File 'lib/excelfile/shared_strings.rb', line 17

def shared_string_for(index)
  at(index.to_i)
end