Class: Shredder::StdIO
- Inherits:
-
Object
- Object
- Shredder::StdIO
- Includes:
- Shredder
- Defined in:
- lib/shredder/stdio.rb
Constant Summary
Constants included from Shredder
Instance Attribute Summary
Attributes included from Shredder
Instance Method Summary collapse
-
#initialize ⇒ StdIO
constructor
this one takes shred filenames and uses $stdin or $stdout appropriately.
- #sew(limit = 0) ⇒ Object
- #shred(limit = 0) ⇒ Object
Methods included from Shredder
Constructor Details
#initialize ⇒ StdIO
this one takes shred filenames and uses $stdin or $stdout appropriately.
5 6 7 |
# File 'lib/shredder/stdio.rb', line 5 def initialize(...) @shreds = shred_files(...) end |
Instance Method Details
#sew(limit = 0) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/shredder/stdio.rb', line 20 def sew(limit=0) readers = count = nil begin readers = @shreds.map{File.open _1, 'r'} count = Streams.new($stdout, readers).sew(limit: limit) ensure readers.each{_1.close} if readers end return count end |
#shred(limit = 0) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/shredder/stdio.rb', line 9 def shred(limit=0) writers = count = nil begin writers = @shreds.map{File.open _1, 'wb'} count = Streams.new($stdin, writers).shred(limit: limit) ensure writers.each{_1.close} if writers end return count end |