Class: Postsvg::Translation::RecordEmitter
- Inherits:
-
Object
- Object
- Postsvg::Translation::RecordEmitter
- Defined in:
- lib/postsvg/translation/record_emitter.rb
Overview
Accumulator of Model::Operator instances that the PsRenderer builds. Thin wrapper around an array; provides a uniform emit surface so handlers don't all need to know how the program is stored.
Instance Attribute Summary collapse
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Instance Method Summary collapse
- #emit(record) ⇒ Object
- #emit_many(records) ⇒ Object
-
#initialize ⇒ RecordEmitter
constructor
A new instance of RecordEmitter.
- #length ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize ⇒ RecordEmitter
Returns a new instance of RecordEmitter.
12 13 14 |
# File 'lib/postsvg/translation/record_emitter.rb', line 12 def initialize @records = [] end |
Instance Attribute Details
#records ⇒ Object (readonly)
Returns the value of attribute records.
10 11 12 |
# File 'lib/postsvg/translation/record_emitter.rb', line 10 def records @records end |
Instance Method Details
#emit(record) ⇒ Object
16 17 18 19 |
# File 'lib/postsvg/translation/record_emitter.rb', line 16 def emit(record) @records << record self end |
#emit_many(records) ⇒ Object
21 22 23 24 |
# File 'lib/postsvg/translation/record_emitter.rb', line 21 def emit_many(records) records.each { |r| emit(r) } self end |
#length ⇒ Object
26 27 28 |
# File 'lib/postsvg/translation/record_emitter.rb', line 26 def length @records.length end |
#to_a ⇒ Object
30 31 32 |
# File 'lib/postsvg/translation/record_emitter.rb', line 30 def to_a @records.dup end |