Class: SaxStream::Collectors::NaiveCollector
- Inherits:
-
Object
- Object
- SaxStream::Collectors::NaiveCollector
- Defined in:
- lib/sax_stream/collectors/naive_collector.rb
Instance Method Summary collapse
- #<<(value) ⇒ Object
- #for_type(klass) ⇒ Object
-
#initialize ⇒ NaiveCollector
constructor
A new instance of NaiveCollector.
- #mapped_objects ⇒ Object
Constructor Details
#initialize ⇒ NaiveCollector
Returns a new instance of NaiveCollector.
4 5 6 |
# File 'lib/sax_stream/collectors/naive_collector.rb', line 4 def initialize @objects = [] end |
Instance Method Details
#<<(value) ⇒ Object
12 13 14 |
# File 'lib/sax_stream/collectors/naive_collector.rb', line 12 def <<(value) @objects << value end |
#for_type(klass) ⇒ Object
16 17 18 |
# File 'lib/sax_stream/collectors/naive_collector.rb', line 16 def for_type(klass) mapped_objects.select { |object| object.class == klass } end |
#mapped_objects ⇒ Object
8 9 10 |
# File 'lib/sax_stream/collectors/naive_collector.rb', line 8 def mapped_objects @objects end |