Class: NexusMods::Api::Category

Inherits:
Resource
  • 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(nexus_mods:, id:, name:, parent_category: nil) ⇒ Category

Constructor

Parameters
  • nexus_mods (NexusMods): The NexusMods API instance that the resource can use to query for other resources

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



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/nexus_mods/api/category.rb', line 30

def initialize(
  nexus_mods:,
  id:,
  name:,
  parent_category: nil
)
  super(nexus_mods:)
  @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?



48
49
50
51
52
53
# File 'lib/nexus_mods/api/category.rb', line 48

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