mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
24 lines
400 B
Swift
24 lines
400 B
Swift
//
|
|
// File.swift
|
|
//
|
|
//
|
|
// Created by Lucas van Dongen on 23/11/2020.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
protocol Rule {
|
|
associatedtype RuleType: Rule
|
|
|
|
func apply(to item: Item) -> Item
|
|
|
|
static func rule(for item: Item) -> RuleType
|
|
static func process(item: Item) -> Item
|
|
}
|
|
|
|
extension Rule {
|
|
static func process(item: Item) -> Item {
|
|
return rule(for: item).apply(to: item)
|
|
}
|
|
}
|