class RubyXL::GenericStorage
Attributes
local_dir_path[R]
Public Class Methods
new(local_dir_path)
click to toggle source
Calls superclass method
# File lib/rubyXL/generic_storage.rb, line 5 def initialize(local_dir_path) @local_dir_path = local_dir_path @mode = 'r' super end
Public Instance Methods
add_to_zip(zipfile)
click to toggle source
# File lib/rubyXL/generic_storage.rb, line 33 def add_to_zip(zipfile) each_pair { |filename, data| zipfile.get_output_stream(File.join(@local_dir_path, filename)) { |f| f << data } } end
binary()
click to toggle source
# File lib/rubyXL/generic_storage.rb, line 11 def binary @mode = 'rb' self end
load_dir(root_dir)
click to toggle source
# File lib/rubyXL/generic_storage.rb, line 16 def load_dir(root_dir) dirpath = File.join(root_dir, @local_dir_path) if File.directory?(dirpath) then (Dir.new(dirpath).entries - ['.', '..', '.DS_Store', '_rels']).each { |filename| self[filename] = File.open(File.join(dirpath, filename), @mode).read } end self end
load_file(root_dir, filename)
click to toggle source
# File lib/rubyXL/generic_storage.rb, line 27 def load_file(root_dir, filename) filepath = File.join(root_dir, @local_dir_path, filename) self[filename] = File.open(filepath, @mode).read if File.readable?(filepath) self end