Ticket #113 (new enhancement)
REXML::Element, REXML::Elements inject methods break compatibility with REXML from ruby 1.8.5
| Reported by: | prak | Owned by: | ser |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1.8 |
| Component: | XPath | Version: | 3.1.4 |
| Severity: | normal | Keywords: | |
| Cc: | prak@… | Ruby version: | 1.8.5 |
| Operating system: | MacOS |
Description
The syntax of the new REXML::Element#inject and REXML::Elements#inject methods are different that for Enumerable's inject in that the REXML inject takes an xpath as the first argument and aggregation object as the second element. This means that code that would work for an Enumerable has to be modified. If the arguments were in reverse order (ie w/ the aggregation object first and the xpath second) then code would just work. This came up because in REXML from ruby 1.8.5 Document#elements returned an object that has Enumerable mixed in.
which meant that in ruby 1.8.5 we could write
doc.root.elements.inject([]) { |s,e|
# whatever
}
but now we have to do this
doc.root.elements.inject(nil, []) { |s,e|
# whatever
}
