mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-11 20:51:27 +00:00
Add abstract class to handle individual item update logic
This commit is contained in:
parent
0e4a0b0fac
commit
7e8e555a1f
@ -1,6 +1,8 @@
|
|||||||
"""Gilded Rose Refactoring Kata."""
|
"""Gilded Rose Refactoring Kata."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
AGED_BRIE: str = "Aged Brie"
|
AGED_BRIE: str = "Aged Brie"
|
||||||
BACKSTAGE_PASSES: str = "Backstage passes to a TAFKAL80ETC concert"
|
BACKSTAGE_PASSES: str = "Backstage passes to a TAFKAL80ETC concert"
|
||||||
CONJURED: str = "Conjured"
|
CONJURED: str = "Conjured"
|
||||||
@ -9,6 +11,33 @@ MIN_QUALITY: int = 0
|
|||||||
SULFURAS: str = "Sulfuras, Hand of Ragnaros"
|
SULFURAS: str = "Sulfuras, Hand of Ragnaros"
|
||||||
SULFURAS_QUALITY: int = 80
|
SULFURAS_QUALITY: int = 80
|
||||||
|
|
||||||
|
class ItemUpdateStrategy(ABC):
|
||||||
|
"""Abstract base class for item update strategies."""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def update_quality(self, item: Item) -> None:
|
||||||
|
"""Update the quality of the given item according to specific rules.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
item : Item
|
||||||
|
The item whose quality is to be updated.
|
||||||
|
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def update_sell_in(self, item: Item) -> None:
|
||||||
|
"""Update the sell_in of the given item according to specific rules.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
item : Item
|
||||||
|
The item whose sell_in is to be updated.
|
||||||
|
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
class GildedRose:
|
class GildedRose:
|
||||||
"""Manages inventory quality updates for the Gilded Rose inn.
|
"""Manages inventory quality updates for the Gilded Rose inn.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user