Class: Xlsxtream::IO::Directory

Inherits:
Object
  • Object
show all
Defined in:
lib/xlsxtream/io/directory.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Directory

Returns a new instance of Directory.



7
8
9
10
# File 'lib/xlsxtream/io/directory.rb', line 7

def initialize(path)
  @path = Pathname(path)
  @file = nil
end

Instance Method Details

#<<(data) ⇒ Object



12
13
14
# File 'lib/xlsxtream/io/directory.rb', line 12

def <<(data)
  @file << data
end

#add_file(path) ⇒ Object



16
17
18
19
20
21
# File 'lib/xlsxtream/io/directory.rb', line 16

def add_file(path)
  close
  file_path = @path + path
  file_path.parent.mkpath
  @file = file_path.open("wb")
end

#closeObject



23
24
25
# File 'lib/xlsxtream/io/directory.rb', line 23

def close
  @file.close if @file
end