Class: NexusMods::Api::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/nexus_mods/api/category.rb

Overview

Categories defined for a game in NexusMods

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, parent_category: nil) ⇒ Category

Constructor

Parameters

id (Integer): The category id name (String): The category id parent_category (Category or nil): The parent category, or nil if none [default: nil]



27
28
29
30
31
32
33
34
35
# File 'lib/nexus_mods/api/category.rb', line 27

def initialize(
  id:,
  name:,
  parent_category: nil
)
  @id = id
  @name = name
  @parent_category = parent_category
end

Instance Method Details

#==(other) ⇒ Object

Equality operator

Parameters
  • other (Object): Other object to compare with

Result
  • Boolean: Are objects equal?



43
44
45
46
47
48
# File 'lib/nexus_mods/api/category.rb', line 43

def ==(other)
  other.is_a?(Category) &&
    @id == other.id &&
    @name == other.name &&
    @parent_category == other.parent_category
end