Class: RubyXL::GenericStorageObject

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyXL/objects/storage.rb

Constant Summary collapse

SAVE_ORDER =
0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path, data) ⇒ GenericStorageObject

Returns a new instance of GenericStorageObject.



8
9
10
11
12
# File 'lib/rubyXL/objects/storage.rb', line 8

def initialize(file_path, data)
  @xlsx_path = file_path
  @data = data
  @generic_storage = []
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



6
7
8
# File 'lib/rubyXL/objects/storage.rb', line 6

def data
  @data
end

#generic_storageObject

Returns the value of attribute generic_storage.



6
7
8
# File 'lib/rubyXL/objects/storage.rb', line 6

def generic_storage
  @generic_storage
end

#xlsx_pathObject

Returns the value of attribute xlsx_path.



6
7
8
# File 'lib/rubyXL/objects/storage.rb', line 6

def xlsx_path
  @xlsx_path
end

Class Method Details

.parse_file(zip_file, file_path) ⇒ Object



14
15
16
# File 'lib/rubyXL/objects/storage.rb', line 14

def self.parse_file(zip_file, file_path)
  (entry = zip_file.find_entry(RubyXL::from_root(file_path))) && self.new(file_path, entry.get_input_stream { |f| f.read })
end

Instance Method Details

#add_to_zip(zip_stream) ⇒ Object



18
19
20
21
22
23
# File 'lib/rubyXL/objects/storage.rb', line 18

def add_to_zip(zip_stream)
  return false if @data.nil?
  zip_stream.put_next_entry(RubyXL::from_root(self.xlsx_path))
  zip_stream.write(@data)
  true
end