require 'pry' class GildedRose def initialize(items) @items = items end def update_quality() @items.each do |item| inListOfThree = ["Aged Brie","Backstage passes to a TAFKAL80ETC concert","Sulfuras, Hand of Ragnaros"] if not inListOfThree.include?(item.name) and item.quality > 0 item.quality = item.quality - 1 else if item.quality < 50 item.quality = item.quality + 1 if item.name == "Backstage passes to a TAFKAL80ETC concert" if item.sell_in < 11 item.quality = item.quality + 1 end end end end if item.name != "Sulfuras, Hand of Ragnaros" item.sell_in = item.sell_in - 1 end if item.sell_in < 0 if item.name != "Aged Brie" if item.name != "Backstage passes to a TAFKAL80ETC concert" item.quality = 0 end else if item.quality < 50 item.quality = item.quality + 1 end end end end end end class Item attr_accessor :name, :sell_in, :quality def initialize(name, sell_in, quality) @name = name @sell_in = sell_in @quality = quality end def to_s() "#{@name}, #{@sell_in}, #{@quality}" end end