refactor backstage path to use regex, this allows other backstage items to work provided backstage is in their name

This commit is contained in:
ollie beney 2020-11-04 15:28:47 +00:00
parent c940184607
commit 2b410aa50b

View File

@ -15,7 +15,7 @@ class GildedRose
else else
if item.quality < 50 if item.quality < 50
item.quality = item.quality + 1 item.quality = item.quality + 1
if item.name == "Backstage passes to a TAFKAL80ETC concert" if item.name.downcase.match /backstage/
if item.sell_in < 11 if item.sell_in < 11
if item.quality < 50 if item.quality < 50
item.quality = item.quality + 1 item.quality = item.quality + 1
@ -34,7 +34,7 @@ class GildedRose
end end
if item.sell_in < 0 if item.sell_in < 0
if item.name != "Aged Brie" if item.name != "Aged Brie"
if item.name != "Backstage passes to a TAFKAL80ETC concert" if !item.name.downcase.match /backstage/
if item.quality > 0 if item.quality > 0
if item.name != "Sulfuras, Hand of Ragnaros" if item.name != "Sulfuras, Hand of Ragnaros"
item.quality = item.quality - 1 item.quality = item.quality - 1