# roughosing/gilded-rose-ruby architecture

> Architecture diagram of the GitHub repository roughosing/gilded-rose-ruby, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/roughosing/gilded-rose-ruby
- Repository: https://github.com/roughosing/gilded-rose-ruby

## Overview

This Ruby kata refactors daily inventory updates into a dispatcher and item-specific rules. The principal workflow is: GildedRose iterates inventory, the factory selects a rule from each item’s name, and that updater changes sell-in and quality. Shared updater logic enforces quality bounds and expiration checks. The README documents normal, aged, backstage, legendary, and conjured behavior. The graph follows the sampled runtime sources and README; unsampled updater details are not inferred beyond documented capabilities.

Main entry points: [`ruby/updaters/item_updater_factory.rb`](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/item_updater_factory.rb) (Updater factory), [`ruby/item/item.rb`](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/item/item.rb) (Inventory item), [`ruby/updaters/normal_item_updater.rb`](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/normal_item_updater.rb) (Normal rules), [`ruby/updaters/backstage_passes_updater.rb`](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/backstage_passes_updater.rb) (Backstage rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Update entry"]
  node_rose["GildedRose<br/>[gilded_rose.rb]"]
end

subgraph group_dispatch["Rule dispatch"]
  node_factory["Updater factory"]
end

subgraph group_rules["Item rules"]
  node_normal["Normal rules"]
  node_brie["Aged Brie rules"]
  node_backstage["Backstage rules"]
  node_sulfuras["Sulfuras rules"]
  node_conjured["Conjured rules"]
end

subgraph group_support["Runtime support"]
  node_inventory["Inventory item<br/>[item.rb]"]
  node_base["Shared updater<br/>[item_updater.rb]"]
  node_loader["Zeitwerk loader<br/>[config.rb]"]
end

node_rose -->|"builds updater"| node_factory
node_rose -->|"iterates items"| node_inventory
node_factory -->|"reads name"| node_inventory
node_factory -->|"selects by name"| node_brie
node_factory -->|"selects by name"| node_backstage
node_factory -->|"selects by name"| node_sulfuras
node_factory -->|"selects by prefix"| node_conjured
node_factory -->|"defaults to"| node_normal
node_normal -->|"updates item"| node_inventory
node_conjured -->|"updates item"| node_inventory
node_backstage -->|"updates item"| node_inventory
node_backstage -->|"uses quality helpers"| node_base
node_conjured -->|"uses quality helpers"| node_base
node_normal -->|"uses quality helpers"| node_base
node_loader -->|"loaded by"| node_rose

click node_inventory "https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/item/item.rb"
click node_rose "https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/gilded_rose.rb"
click node_factory "https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/item_updater_factory.rb"
click node_base "https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/item_updater.rb"
click node_normal "https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/normal_item_updater.rb"
click node_brie "https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/aged_brie_updater.rb"
click node_backstage "https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/backstage_passes_updater.rb"
click node_sulfuras "https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/sulfuras_updater.rb"
click node_conjured "https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/conjured_updater.rb"
click node_loader "https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/config.rb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_rose toneBlue
class node_factory toneAmber
class node_normal,node_brie,node_backstage,node_sulfuras,node_conjured toneMint
class node_inventory,node_base,node_loader toneRose
```

## Components

### Update entry

- [GildedRose](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/gilded_rose.rb): `ruby/gilded_rose.rb`

### Rule dispatch

- [Updater factory](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/item_updater_factory.rb): `ruby/updaters/item_updater_factory.rb`

### Item rules

- [Normal rules](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/normal_item_updater.rb): `ruby/updaters/normal_item_updater.rb`
- [Aged Brie rules](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/aged_brie_updater.rb): `ruby/updaters/aged_brie_updater.rb`
- [Backstage rules](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/backstage_passes_updater.rb): `ruby/updaters/backstage_passes_updater.rb`
- [Sulfuras rules](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/sulfuras_updater.rb): `ruby/updaters/sulfuras_updater.rb`
- [Conjured rules](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/conjured_updater.rb): `ruby/updaters/conjured_updater.rb`

### Runtime support

- [Inventory item](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/item/item.rb): `ruby/item/item.rb`
- [Shared updater](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/updaters/item_updater.rb): `ruby/updaters/item_updater.rb`
- [Zeitwerk loader](https://github.com/roughosing/gilded-rose-ruby/blob/main/ruby/config.rb): `ruby/config.rb`

## Connections

- GildedRose → Updater factory: builds updater (evidence: `ruby/gilded_rose.rb`)
- GildedRose → Inventory item: iterates items (evidence: `ruby/gilded_rose.rb`)
- Updater factory → Inventory item: reads name (evidence: `ruby/updaters/item_updater_factory.rb`)
- Updater factory → Aged Brie rules: selects by name (evidence: `ruby/updaters/item_updater_factory.rb`)
- Updater factory → Backstage rules: selects by name (evidence: `ruby/updaters/item_updater_factory.rb`)
- Updater factory → Sulfuras rules: selects by name (evidence: `ruby/updaters/item_updater_factory.rb`)
- Updater factory → Conjured rules: selects by prefix (evidence: `ruby/updaters/item_updater_factory.rb`)
- Updater factory → Normal rules: defaults to (evidence: `ruby/updaters/item_updater_factory.rb`)
- Normal rules → Inventory item: updates item (evidence: `ruby/updaters/normal_item_updater.rb`)
- Conjured rules → Inventory item: updates item (evidence: `ruby/updaters/conjured_updater.rb`)
- Backstage rules → Inventory item: updates item (evidence: `ruby/updaters/backstage_passes_updater.rb`)
- Backstage rules → Shared updater: uses quality helpers (evidence: `ruby/updaters/backstage_passes_updater.rb`)
- Conjured rules → Shared updater: uses quality helpers (evidence: `ruby/updaters/conjured_updater.rb`)
- Normal rules → Shared updater: uses quality helpers (evidence: `ruby/updaters/normal_item_updater.rb`)
- Zeitwerk loader → GildedRose: loaded by (evidence: `ruby/gilded_rose.rb`)
