mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-21 09:21:08 +00:00
refactor: add switch cases
This commit is contained in:
parent
8a9b6977f0
commit
671461d440
@ -1,12 +1,25 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
class GildedRose(object):
|
class GildedRose(object):
|
||||||
|
BACKSTAGE = 'Backstage passes to a TAFKAL80ETC concert'
|
||||||
|
SULFURAS = 'Sulfuras, Hand of Ragnaros'
|
||||||
|
AGED_BRIE = 'Aged Brie'
|
||||||
|
|
||||||
def __init__(self, items):
|
def __init__(self, items):
|
||||||
self.items = items
|
self.items = items
|
||||||
|
|
||||||
def update_quality(self):
|
def update_quality(self):
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
|
|
||||||
|
match item.name:
|
||||||
|
case self.AGED_BRIE:
|
||||||
|
pass
|
||||||
|
case self.SULFURAS:
|
||||||
|
pass
|
||||||
|
case self.BACKSTAGE:
|
||||||
|
pass
|
||||||
|
case _:
|
||||||
|
pass
|
||||||
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert":
|
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert":
|
||||||
if item.quality > 0:
|
if item.quality > 0:
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros":
|
if item.name != "Sulfuras, Hand of Ragnaros":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user