Module: Lich::Gemstone::Infomon::Parser::State Private

Defined in:
documented/gemstone/infomon/parser.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Tracks parser state during multi-line game output sequences.

Manages transitions between Ready, Goals training, Profile display, and multi-step Enhancive inventory reporting. Validates state transitions and prevents concurrent parsing of conflicting outputs.

Constant Summary collapse

Goals =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:goals
Profile =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:profile
Ready =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:ready
EnhanciveStats =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Enhancive parsing states

:enhancive_stats
EnhanciveSkills =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:enhancive_skills
EnhanciveResources =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:enhancive_resources
EnhanciveMartial =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:enhancive_martial
EnhanciveSpells =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:enhancive_spells
EnhanciveStatistics =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:enhancive_statistics

Class Method Summary collapse

Class Method Details

.enhancive_state? ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Tests whether the parser is in an Enhancive multi-line sequence.

Returns:

  • (Boolean) —

    true if in any Enhancive state (Stats, Skills, Resources, Martial, Spells, or Statistics); false if Ready, Goals, or Profile

See Also:



273
274
275
276
# File 'documented/gemstone/infomon/parser.rb', line 273

def self.enhancive_state?
  [EnhanciveStats, EnhanciveSkills, EnhanciveResources,
   EnhanciveMartial, EnhanciveSpells, EnhanciveStatistics].include?(@state)
end

.get ⇒ Symbol

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the current parser state.

Returns:

  • (Symbol) —

    one of Goals, Profile, Ready, EnhanciveStats, EnhanciveSkills, EnhanciveResources, EnhanciveMartial, EnhanciveSpells, or EnhanciveStatistics

See Also:



264
265
266
# File 'documented/gemstone/infomon/parser.rb', line 264

def self.get
  @state
end

.set(state) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Transitions to a new parser state with validation.

Goals and Profile states can only start from Ready. Enhancive states may start from Ready or transition between other Enhancive states. Raises if the transition is invalid for the current state.

Parameters:

  • state (Symbol) —

    the target state (one of Goals, Profile, Ready, EnhanciveStats, EnhanciveSkills, EnhanciveResources, EnhanciveMartial, EnhanciveSpells, EnhanciveStatistics)

Raises:

  • (RuntimeError) —

    if the state transition is invalid

See Also:



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'documented/gemstone/infomon/parser.rb', line 242

def self.set(state)
  case state
  when Goals, Profile
    unless @state.eql?(Ready)
      Lich.log "error: Infomon::Parser::State is in invalid state(#{@state}) - caller: #{caller[0]}"
      fail "--- Lich: error: Infomon::Parser::State is in invalid state(#{@state}) - caller: #{caller[0]}"
    end
  when EnhanciveStats, EnhanciveSkills, EnhanciveResources, EnhanciveMartial, EnhanciveSpells, EnhanciveStatistics
    # Enhancive states can start from Ready or transition between each other
    unless @state.eql?(Ready) || enhancive_state?
      Lich.log "error: Infomon::Parser::State is in invalid state(#{@state}) - caller: #{caller[0]}"
      fail "--- Lich: error: Infomon::Parser::State is in invalid state(#{@state}) - caller: #{caller[0]}"
    end
  end
  @state = state
end