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.
12 13 14 15 16 17 18 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 12 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.
10 11 12 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 10 def available @available end |
#chars ⇒ Object
Returns the value of attribute chars.
10 11 12 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 10 def chars @chars end |
#continued_chars ⇒ Object
Returns the value of attribute continued_chars.
10 11 12 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 10 def continued_chars @continued_chars end |
#flags ⇒ Object
Returns the value of attribute flags.
10 11 12 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 10 def flags @flags end |
#phonetic ⇒ Object
Returns the value of attribute phonetic.
10 11 12 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 10 def phonetic @phonetic end |
#richtext ⇒ Object
Returns the value of attribute richtext.
10 11 12 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 10 def richtext @richtext end |
#wide ⇒ Object
Returns the value of attribute wide.
10 11 12 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 10 def wide @wide end |
Instance Method Details
#content ⇒ Object
Access the contents of this Shared String
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 22 def content @content or begin 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
39 40 41 42 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 39 def continue offset, size, chars @continued_chars -= chars @continuations.push [offset, size] end |
#continued? ⇒ Boolean
:nodoc:
44 45 46 |
# File 'lib/spreadsheet/excel/sst_entry.rb', line 44 def continued? # :nodoc: @continued_chars > 0 end |