Class: ReadXls::RecordHandler::Boundsheet
- Defined in:
- lib/read_xls/record_handler/boundsheet.rb
Instance Attribute Summary collapse
-
#position ⇒ Object
Returns the value of attribute position.
Attributes inherited from Base
#biff, #builder, #record_data, #record_number
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from ReadXls::RecordHandler::Base
Instance Attribute Details
#position ⇒ Object
Returns the value of attribute position.
4 5 6 |
# File 'lib/read_xls/record_handler/boundsheet.rb', line 4 def position @position end |
Instance Method Details
#call ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/read_xls/record_handler/boundsheet.rb', line 6 def call worksheet_builder = ::ReadXls::Workbook::WorksheetBuilder.new offset = record_data.unpack("v").first self.position = offset loop do record_number = read_byte break if record_number == ::ReadXls::RecordHandler::EOF record_length = read_byte record_data = read_data(record_length) ::ReadXls::RecordHandler.call( record_number, worksheet_builder, biff, record_data ) end builder.add_worksheet_builder(worksheet_builder) end |
#read_byte ⇒ Object
36 37 38 39 40 |
# File 'lib/read_xls/record_handler/boundsheet.rb', line 36 def read_byte val = biff.byteslice(position, 2).unpack("v") self.position += 2 val.first || raise(ParsingFailedError, "expected to get value, got nil") end |
#read_data(bytes) ⇒ Object
29 30 31 32 33 |
# File 'lib/read_xls/record_handler/boundsheet.rb', line 29 def read_data(bytes) val = biff.byteslice(position, bytes) self.position += bytes val end |