Class: OLEStorageLitePPSFile

Inherits:
OLEStorageLitePPS show all
Defined in:
lib/WriteExcel/storage_lite.rb

Constant Summary

Constants inherited from OLEStorageLite

OLEStorageLite::DATA_SIZE_SMALL, OLEStorageLite::LONG_INT_SIZE, OLEStorageLite::PPS_SIZE, OLEStorageLite::PPS_TYPE_DIR, OLEStorageLite::PPS_TYPE_FILE, OLEStorageLite::PPS_TYPE_ROOT

Instance Attribute Summary

Attributes inherited from OLEStorageLitePPS

#child, #data, #dir_pps, #name, #next_pps, #no, #pps_file, #prev_pps, #size, #start_block, #time_1st, #time_2nd, #type

Instance Method Summary collapse

Methods inherited from OLEStorageLite

#asc2ucs, #localDate2OLE, #ucs2asc

Constructor Details

#initialize(sNm, data = '') ⇒ OLEStorageLitePPSFile

Returns a new instance of OLEStorageLitePPSFile.



548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# File 'lib/WriteExcel/storage_lite.rb', line 548

def initialize(sNm, data = '')
  super(
      nil,
      sNm || '',
      PPS_TYPE_FILE,
      nil,
      nil,
      nil,
      nil,
      nil,
      nil,
      nil,
      data || '',
      nil
    )
end

Instance Method Details

#append(data) ⇒ Object



581
582
583
584
585
586
587
588
589
# File 'lib/WriteExcel/storage_lite.rb', line 581

def append (data)
  return if data.nil?
  if @pps_file
    @pps_file << data
    @pps_file.flush
  else
    @data << data
  end
end

#set_file(sFile = '') ⇒ Object



565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
# File 'lib/WriteExcel/storage_lite.rb', line 565

def set_file(sFile = '')
  if sFile.nil? or sFile == ''
    @pps_file = Tempfile.new('OLEStorageLitePPSFile')
  elsif sFile.kind_of?(IO) || sFile.kind_of?(StringIO)
    @pps_file = sFile
  elsif sFile.kind_of?(String)
    #File Name
    @pps_file = open(sFile, "r+")
    return nil unless @pps_file
  else
    return nil
  end
  @pps_file.seek(0, IO::SEEK_END)
  @pps_file.binmode
end