lib/galaxy_converter/detector.rb in galaxy_converter-3.0.1 vs lib/galaxy_converter/detector.rb in galaxy_converter-3.1.1
- old
+ new
@@ -8,15 +8,15 @@
attr_reader :converter
def initialize(notes, converter = Converter)
notes = notes.reject(&:question?)
- @commercials, @assertions = notes.partition(&:commercial?)
+ @credits, @assertions = notes.partition { |note| note.instance_of? Credit }
@converter = converter.new(mapping)
end
def goods
- @goods ||= @commercials.reduce({}) do |acc, note|
+ @goods ||= @credits.reduce({}) do |acc, note|
matching = note.body.match(GOODS_RULE)
next acc unless matching
units, name, credits = matching.captures
value = @converter.call(units)
next acc if value.zero?