lib/galaxy_converter/note.rb in galaxy_converter-3.1.1 vs lib/galaxy_converter/note.rb in galaxy_converter-3.1.2

- old
+ new

@@ -1,14 +1,15 @@ module GalaxyConverter class Note PREFIXES = ["how much is", "how many credits is"] QUESTION = "?" NO_IDEA = "I have no idea what you are talking about" + CREDITS = "credits" def self.from(notes) Array(notes).map do |body| - klass = body.index(/credits/i) ? Credit : Note + klass = body.index(/#{CREDITS}/i) ? Credit : Note klass.new(body) end end attr_reader :body, :units, :good @@ -41,11 +42,10 @@ end end class Credit < Note def answer(total = 0) - s = super - s << " Credits" + super << " #{CREDITS.capitalize}" end private def detect tokens = stripped.split good = tokens.pop