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.



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

def initialize(stream)
  @stream = stream
end

Instance Method Details

#<<(data) ⇒ Object



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

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

#add_file(path) ⇒ Object



12
13
14
15
16
# File 'lib/xlsxtream/io/stream.rb', line 12

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

#closeObject



18
19
20
# File 'lib/xlsxtream/io/stream.rb', line 18

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