Class: SaxStream::Internal::SingularRelationshipCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/sax_stream/internal/singular_relationship_collector.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, relation_name) ⇒ SingularRelationshipCollector

Returns a new instance of SingularRelationshipCollector.



4
5
6
7
# File 'lib/sax_stream/internal/singular_relationship_collector.rb', line 4

def initialize(parent, relation_name)
  @parent = parent
  @relation_name = relation_name
end

Instance Method Details

#<<(value) ⇒ Object



9
10
11
12
13
14
# File 'lib/sax_stream/internal/singular_relationship_collector.rb', line 9

def <<(value)
  if @parent.relations[@relation_name]
    raise ProgramError, "found singular relationship #{@relation_name.inspect} occuring more than once. Existing is #{@parent.relations[@relation_name].inspect}"
  end
  @parent.relations[@relation_name] = value
end