Class: OpenXML::SpreadsheetML::SharedString

Inherits:
Object
  • Object
show all
Defined in:
lib/xlsx/shared_string.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ SharedString

values is an array



4
5
6
# File 'lib/xlsx/shared_string.rb', line 4

def initialize values # values is an array
  @values = values
end

Class Method Details

.parser(content) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/xlsx/shared_string.rb', line 12

def self.parser content
  values = []
  doc = Nokogiri::XML content
  t_tags = doc.css('t')
  t_tags.each do |t|
    values << t.text
  end
  SharedString.new values
end

Instance Method Details

#[](index) ⇒ Object



8
9
10
# File 'lib/xlsx/shared_string.rb', line 8

def [] index
  @values[index]
end