Class: Spreadsheet::Excel::SstEntry
- Inherits:
-
Object
- Object
- Spreadsheet::Excel::SstEntry
- Includes:
- Spreadsheet::Encodings
- Defined in:
- lib/spreadsheet/excel/sst_entry.rb
Overview
Shared String Table Entry
Instance Attribute Summary collapse
-
#available ⇒ Object
Returns the value of attribute available.
-
#chars ⇒ Object
Returns the value of attribute chars.
-
#continued_chars ⇒ Object
Returns the value of attribute continued_chars.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#phonetic ⇒ Object
Returns the value of attribute phonetic.
-
#richtext ⇒ Object
Returns the value of attribute richtext.
-
#wide ⇒ Object
Returns the value of attribute wide.
Instance Method Summary collapse
-
#content ⇒ Object
Access the contents of this Shared String.
-
#continue(offset, size, chars) ⇒ Object
Register the offset of a String continuation.
-
#continued? ⇒ Boolean
:nodoc:.
-
#initialize(opts = {}) ⇒ SstEntry
constructor
A new instance of SstEntry.
Constructor Details
#initialize(opts = {}) ⇒ SstEntry
Returns a new instance of SstEntry.
11 12 13 14 15 16 17 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 11 def initialize opts = {} @content = nil @offset = opts[:offset] @ole = opts[:ole] @reader = opts[:reader] @continuations = [] end |
Instance Attribute Details
#available ⇒ Object
Returns the value of attribute available.
9 10 11 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 9 def available @available end |
#chars ⇒ Object
Returns the value of attribute chars.
9 10 11 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 9 def chars @chars end |
#continued_chars ⇒ Object
Returns the value of attribute continued_chars.
9 10 11 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 9 def continued_chars @continued_chars end |
#flags ⇒ Object
Returns the value of attribute flags.
9 10 11 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 9 def flags @flags end |
#phonetic ⇒ Object
Returns the value of attribute phonetic.
9 10 11 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 9 def phonetic @phonetic end |
#richtext ⇒ Object
Returns the value of attribute richtext.
9 10 11 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 9 def richtext @richtext end |
#wide ⇒ Object
Returns the value of attribute wide.
9 10 11 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 9 def wide @wide end |
Instance Method Details
#content ⇒ Object
Access the contents of this Shared String
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 20 def content @content or begin data = nil data = @ole[@offset, @available] content, _ = @reader.read_string_body data, @flags, @available, @wide @continuations.each do |offset, len| @reader.continue_string(@ole[offset,len], [content, @chars]) end content = client content, 'UTF-16LE' if @reader.memoize? @content = content end content end end |
#continue(offset, size, chars) ⇒ Object
Register the offset of a String continuation
37 38 39 40 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 37 def continue offset, size, chars @continued_chars -= chars @continuations.push [offset, size] end |
#continued? ⇒ Boolean
:nodoc:
41 42 43 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 41 def continued? # :nodoc: @continued_chars > 0 end |