Class: OLEStorageLitePPSFile

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

Overview

:nodoc:

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

Attributes inherited from OLEStorageLite

#file

Instance Method Summary collapse

Methods inherited from OLEStorageLite

#asc2ucs, #getNthPps, #getPpsSearch, #getPpsTree, #localDate2OLE, #oleData2Local, #ucs2asc

Constructor Details

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

Returns a new instance of OLEStorageLitePPSFile


945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
# File 'lib/writeexcel/storage_lite.rb', line 945

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


978
979
980
981
982
983
984
985
986
# File 'lib/writeexcel/storage_lite.rb', line 978

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


962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
# File 'lib/writeexcel/storage_lite.rb', line 962

def set_file(sFile = '')
  if sFile.nil? or sFile == ''
    @pps_file = Tempfile.new('OLEStorageLitePPSFile')
  elsif sFile.respond_to?(:write)
    @pps_file = sFile
  elsif sFile.respond_to?(:to_str)
    #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