Class: Factorix::MODState

Inherits:
Data
  • Object
show all
Defined in:
lib/factorix/mod_state.rb,
lib/factorix/mod_state.rb,
sig/factorix/mod_state.rbs

Overview

Represents the state of a MOD in a MOD list

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled:, version: nil) ⇒ MODState

Initialize a new MODState

Examples:

Creating a MODState

state = Factorix::MODState[enabled: true]
version = Factorix::MODVersion.from_string("1.2.3")
state = Factorix::MODState[enabled: false, version: version]

Parameters:

  • enabled (Boolean) —

    whether the MOD is enabled

  • version (Factorix::MODVersion, nil) (defaults to: nil) —

    the version of the MOD (optional)

  • enabled: (Boolean)
  • version: (MODVersion, nil) (defaults to: nil)


21
# File 'lib/factorix/mod_state.rb', line 21

def initialize(enabled:, version: nil) = super

Instance Attribute Details

#enabled ⇒ Boolean (readonly)

Returns whether the MOD is enabled.

Returns:

  • (Boolean) —

    whether the MOD is enabled



23
24
25
# File 'lib/factorix/mod_state.rb', line 23

def enabled
  @enabled
end

#version ⇒ Factorix::MODVersion? (readonly)

Returns the version of the MOD, or nil if the version is not specified.

Returns:



26
27
28
# File 'lib/factorix/mod_state.rb', line 26

def version
  @version
end

Class Method Details

.[] ⇒ MODState

Parameters:

Returns:



14
# File 'sig/factorix/mod_state.rbs', line 14

def self.[]: (enabled: bool, ?version: MODVersion?) -> MODState

Instance Method Details

#enabled? ⇒ Boolean

Check if the MOD is enabled

Returns:

  • (Boolean) —

    true if the MOD is enabled, false otherwise



32
# File 'lib/factorix/mod_state.rb', line 32

def enabled? = enabled