mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-04 09:11:39 +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."""
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
AGED_BRIE: str = "Aged Brie"
|
||||
BACKSTAGE_PASSES: str = "Backstage passes to a TAFKAL80ETC concert"
|
||||
CONJURED: str = "Conjured"
|
||||
@ -9,6 +11,33 @@ MIN_QUALITY: int = 0
|
||||
SULFURAS: str = "Sulfuras, Hand of Ragnaros"
|
||||
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:
|
||||
"""Manages inventory quality updates for the Gilded Rose inn.
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user