Class: Factorix::API::Category
- Inherits:
-
Data
- Object
- Data
- Factorix::API::Category
- Defined in:
- lib/factorix/api/category.rb,
lib/factorix/api/category.rb
Overview
Category object from MOD Portal API
Represents a MOD category with value, name, and description. Uses flyweight pattern - same category value returns same instance.
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
Category description.
-
#name ⇒ String
readonly
Human-readable category name (e.g., “Content”, “Utilities”).
-
#value ⇒ String
readonly
Category value (e.g., “content”, “utilities”, “” for no category).
Class Method Summary collapse
-
.for(value) ⇒ Category
Get Category instance for the given value.
-
.identifiers ⇒ Array<String>
All category identifiers.
Instance Attribute Details
#description ⇒ String (readonly)
Returns category description.
14 15 16 |
# File 'lib/factorix/api/category.rb', line 14 def description @description end |
#name ⇒ String (readonly)
Returns human-readable category name (e.g., “Content”, “Utilities”).
14 15 16 |
# File 'lib/factorix/api/category.rb', line 14 def name @name end |
#value ⇒ String (readonly)
Returns category value (e.g., “content”, “utilities”, “” for no category).
14 15 16 |
# File 'lib/factorix/api/category.rb', line 14 def value @value end |
Class Method Details
.for(value) ⇒ Category
Get Category instance for the given value
Returns predefined instance for known categories (flyweight pattern). Raises an error for unknown category values.
67 |
# File 'lib/factorix/api/category.rb', line 67 def self.for(value) = CATEGORIES.fetch(value.to_s) |
.identifiers ⇒ Array<String>
Returns all category identifiers.
57 |
# File 'lib/factorix/api/category.rb', line 57 def self.identifiers = CATEGORIES.keys |