Class: Tb::FileHeaderEnumerator::HBuilder
- Inherits:
-
Object
- Object
- Tb::FileHeaderEnumerator::HBuilder
- Defined in:
- lib/tb/fileenumerator.rb
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
Instance Method Summary collapse
- #gen(*objs) ⇒ Object
-
#initialize(klass) ⇒ HBuilder
constructor
A new instance of HBuilder.
- #new ⇒ Object
Constructor Details
#initialize(klass) ⇒ HBuilder
Returns a new instance of HBuilder.
305 306 307 308 309 310 |
# File 'lib/tb/fileenumerator.rb', line 305 def initialize(klass) @klass = klass @tempfile = Tempfile.new("tb") @tempfile.binmode @header = [] end |
Instance Attribute Details
#header ⇒ Object (readonly)
Returns the value of attribute header.
311 312 313 |
# File 'lib/tb/fileenumerator.rb', line 311 def header @header end |
Instance Method Details
#gen(*objs) ⇒ Object
313 314 315 316 |
# File 'lib/tb/fileenumerator.rb', line 313 def gen(*objs) @header |= objs[0].keys Marshal.dump(objs, @tempfile) end |
#new ⇒ Object
318 319 320 321 322 323 324 |
# File 'lib/tb/fileenumerator.rb', line 318 def new @tempfile.close @klass.new( @header, lambda { open(@tempfile.path, "rb") }, lambda { @tempfile.close(true) }) end |