lib/tree.rb in rubrowser-0.1.5 vs lib/tree.rb in rubrowser-0.1.6
- old
+ new
@@ -3,11 +3,11 @@
attr_reader :name, :children, :occurences, :parent
def self.from_parsers(parsers)
return Tree.new if parsers.empty?
- definitions = parsers.map(&:definitions).reduce(:+).uniq
- occurences = parsers.map(&:occurences).reduce(:+).uniq
+ definitions = parsers.map(&:definitions).reduce([], :+).uniq
+ occurences = parsers.map(&:occurences).reduce([], :+).uniq
Tree.new.tap do |tree|
definitions.each { |definition| tree.add_child(definition) }
occurences.each { |occurence| tree.add_occurence(*occurence.first) }
end
end