Class: Xlsxtream::IO::Stream

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

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ Stream

Returns a new instance of Stream.



5
6
7
8
# File 'lib/xlsxtream/io/stream.rb', line 5

def initialize(stream)
  @stream = stream
  @path = nil
end

Instance Method Details

#<<(data) ⇒ Object



10
11
12
# File 'lib/xlsxtream/io/stream.rb', line 10

def <<(data)
  @stream << data
end

#add_file(path) ⇒ Object



14
15
16
17
18
# File 'lib/xlsxtream/io/stream.rb', line 14

def add_file(path)
  close
  @path = path
  @stream << "#@path\n"
end

#closeObject



20
21
22
# File 'lib/xlsxtream/io/stream.rb', line 20

def close
  @stream << "\n" if @path
end