Class: SaxStream::Collectors::NaiveCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/sax_stream/collectors/naive_collector.rb

Instance Method Summary collapse

Constructor Details

#initializeNaiveCollector

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_objectsObject



8
9
10
# File 'lib/sax_stream/collectors/naive_collector.rb', line 8

def mapped_objects
  @objects
end