Module: Zip::IOExtras::AbstractOutputStream
Overview
Implements many of the output convenience methods of IO. relies on <<
Instance Method Summary collapse
- #print(*params) ⇒ Object
- #printf(aFormatString, *params) ⇒ Object
- #putc(anObject) ⇒ Object
- #puts(*params) ⇒ Object
- #write(data) ⇒ Object
Methods included from FakeIO
Instance Method Details
#print(*params) ⇒ Object
150 151 152 |
# File 'lib/zip/ioextras.rb', line 150 def print(*params) self << params.join($,) << $\.to_s end |
#printf(aFormatString, *params) ⇒ Object
154 155 156 |
# File 'lib/zip/ioextras.rb', line 154 def printf(aFormatString, *params) self << sprintf(aFormatString, *params) end |
#putc(anObject) ⇒ Object
158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/zip/ioextras.rb', line 158 def putc(anObject) self << case anObject when Fixnum then anObject.chr when String then anObject else raise TypeError, "putc: Only Fixnum and String supported" end anObject end |
#puts(*params) ⇒ Object
170 171 172 173 174 175 176 177 |
# File 'lib/zip/ioextras.rb', line 170 def puts(*params) params << "\n" if params.empty? params.flatten.each do |element| val = element.to_s self << val self << "\n" unless val[-1, 1] == "\n" end end |
#write(data) ⇒ Object
144 145 146 147 |
# File 'lib/zip/ioextras.rb', line 144 def write(data) self << data data.to_s.bytesize end |