mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-16 10:55:09 +00:00
a - Apply SwiftFormat
This commit is contained in:
5 files changed
+27
-23
No files matched your search
@@ -1,13 +1,13 @@
|
||||
public class GildedRose {
|
||||
var items: [Item]
|
||||
|
||||
|
||||
public init(items: [Item]) {
|
||||
self.items = items
|
||||
}
|
||||
|
||||
|
||||
public func updateQuality() {
|
||||
for i in 0 ..< items.count {
|
||||
if items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert" {
|
||||
if items[i].name != "Aged Brie", items[i].name != "Backstage passes to a TAFKAL80ETC concert" {
|
||||
if items[i].quality > 0 {
|
||||
if items[i].name != "Sulfuras, Hand of Ragnaros" {
|
||||
items[i].quality = items[i].quality - 1
|
||||
@@ -16,14 +16,14 @@ public class GildedRose {
|
||||
} else {
|
||||
if items[i].quality < 50 {
|
||||
items[i].quality = items[i].quality + 1
|
||||
|
||||
|
||||
if items[i].name == "Backstage passes to a TAFKAL80ETC concert" {
|
||||
if items[i].sellIn < 11 {
|
||||
if items[i].quality < 50 {
|
||||
items[i].quality = items[i].quality + 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if items[i].sellIn < 6 {
|
||||
if items[i].quality < 50 {
|
||||
items[i].quality = items[i].quality + 1
|
||||
@@ -32,11 +32,11 @@ public class GildedRose {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if items[i].name != "Sulfuras, Hand of Ragnaros" {
|
||||
items[i].sellIn = items[i].sellIn - 1
|
||||
}
|
||||
|
||||
|
||||
if items[i].sellIn < 0 {
|
||||
if items[i].name != "Aged Brie" {
|
||||
if items[i].name != "Backstage passes to a TAFKAL80ETC concert" {
|
||||
|
||||
@@ -2,7 +2,7 @@ public class Item {
|
||||
public var name: String
|
||||
public var sellIn: Int
|
||||
public var quality: Int
|
||||
|
||||
|
||||
public init(name: String, sellIn: Int, quality: Int) {
|
||||
self.name = name
|
||||
self.sellIn = sellIn
|
||||
@@ -12,6 +12,6 @@ public class Item {
|
||||
|
||||
extension Item: CustomStringConvertible {
|
||||
public var description: String {
|
||||
name + ", " + String(sellIn) + ", " + String(quality);
|
||||
name + ", " + String(sellIn) + ", " + String(quality)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user