Class: Tb::FileEnumerator::Builder
- Inherits:
-
Object
- Object
- Tb::FileEnumerator::Builder
- Defined in:
- lib/tb/fileenumerator.rb
Instance Method Summary collapse
- #gen(*objs) ⇒ Object
-
#initialize(klass) ⇒ Builder
constructor
A new instance of Builder.
- #new ⇒ Object
Constructor Details
#initialize(klass) ⇒ Builder
Returns a new instance of Builder.
54 55 56 57 58 |
# File 'lib/tb/fileenumerator.rb', line 54 def initialize(klass) @klass = klass @tempfile = Tempfile.new("tb") @tempfile.binmode end |
Instance Method Details
#gen(*objs) ⇒ Object
60 61 62 |
# File 'lib/tb/fileenumerator.rb', line 60 def gen(*objs) Marshal.dump(objs, @tempfile) end |
#new ⇒ Object
64 65 66 67 68 69 |
# File 'lib/tb/fileenumerator.rb', line 64 def new @tempfile.close @klass.new( lambda { open(@tempfile.path, "rb") }, lambda { @tempfile.close(true) }) end |