class RubyXL::SharedStrings

Attributes

count_attr[RW]
unique_count_attr[RW]

Public Class Methods

new() click to toggle source
# File lib/rubyXL/shared_strings.rb, line 6
def initialize
  # So far, going by the structure that the original creator had in mind. However,
  # since the actual implementation is now extracted into a separate class,
  # we will be able to transparrently change it later if needs be.
  @content_by_index = []
  @index_by_content = {}
  @unique_count_attr = @count_attr = nil # TODO
end

Public Instance Methods

[](index) click to toggle source
# File lib/rubyXL/shared_strings.rb, line 30
def[](index)
  @content_by_index[index]
end
add(str, index) click to toggle source
# File lib/rubyXL/shared_strings.rb, line 19
def add(str, index)
  @content_by_index[index] = str
  @index_by_content[str] = index
end
empty?() click to toggle source
# File lib/rubyXL/shared_strings.rb, line 15
def empty?
  @content_by_index.empty?
end
get_index(str, add_if_missing = false) click to toggle source
# File lib/rubyXL/shared_strings.rb, line 24
def get_index(str, add_if_missing = false)
  index = @index_by_content[str]
  index = add(str) if index.nil? && add_if_missing
  index 
end